
binding assembler functions with c++ function members
Reported by Peter Johnson | June 25th, 2011 @ 07:49 PM
Originally posted on Trac by loaf109@start.no
Original
Trac Ticket
Description
Hi
Ive yet to find an assembler that can bind/link a c++ function entry to an external function in an asm object or similar. What I want to do is to avoid using GCC's inline asm for my special optimized cases.
Im working on a modular sound system, so speed is important aswell as a good design.
At this moment I use nasm+gcc(g++) and link external asm
functions as C functions. So the function members that are linked
needs to be static. As of what Ive understood a static function
member is exactly the same call convention as a C function.
STDCALL.
What I want though is Thiscall convention, but as you guys probably
are gonna reply to me, there are no real c++ function call
standard. Each c++ compiler solves this differently. But it would
be really nice to atleast have support for GCC thiscall convention
:)
Trac Attachments
h3. Trac Comments
comment:1
Changed 5 years ago by mu
What sort of support are you looking for from Yasm on this? If it's a matter of shuffling the arguments and stack around to implement any given calling convention, I don't think that's the place of the assembler to do. You can see the invoke macro which implements one C calling standard, and use it as a base to write one for whatever convention you need. My understanding is, regsiter vs. stack notwithstanding, the difference is that a this pointer is an implicit argument, and otherwise it's much like a C call. http://www.angelcode.com/dev/callconv/callconv.html seems to be a good description of what various compilers use for various conventions (I just found that in a search).
comment:2
Changed 5 years ago by mu
If you need to deal with mangled function names and linking against those, the easiest thing to do is probably to make sure the functinos you need are extern "C" so they don't get mangled; alternately we could add a way to express a mangled name that is otherwise not accepted by Yasm. Raymon Chen's coverage of this for Microsoft compilers says thiscall is particularly confusingly mangled.
comment:3
Changed 4 years ago by peter@tortall.net
This is best handling through the macro facility, not natively in the assembler itself, at least in NASM syntax.
comment:3
Changed 4 years ago by peter@tortall.net
Status
changed from new to closed
Resolution
set to wontfix
This is best handling through the macro facility, not natively in the assembler itself, at least in NASM syntax.
Status
changed from new to closed
Resolution
set to wontfix
Comments and changes to this ticket
-
Paul Wallace July 24th, 2020 @ 01:50 PM
Thanks for the info. That's what I my peinture IT team were looking for.
-
danish March 4th, 2021 @ 08:10 AM
The Karnataka PUC result is expected to announce on April 15, Monday, by the Department of Pre-University Examination. The KAR 1st PUC result 2021 might alsoSuvudya PUC Result 2021 be declared in May as teachers will be assigned election duties for the Lok Sabha polls. The Karnataka II PU Results can be checked on these websites: kseeb.kar.nic.in (official website).
-
danish March 8th, 2021 @ 12:02 PM
checking through the net, Appreciation for being really thoughtful. The post contains really beneficial information. seo packages
-
danish March 9th, 2021 @ 11:10 AM
Quality articles is the important to attract the people to pay a visit the website, that?s what this web site is providing. AFFORDABLE MONTHLY OFF-PAGE SEO PACKAGES
-
danish March 19th, 2021 @ 10:04 AM
Virtual endorsement has changed the entirety of organizations, and I became acquainted with about this from https://personal-development.com/articles/effective-implementation-of-electronic-signatures-in-your-company.htmeffective-implementation-of-electronic-signatures-in-your-company.htm business. I trust that more data will be delivered soon.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
The Yasm Modular Assembler Project