digitalmars.D - D's calling convention
- Kevin VR (13/13) Apr 30 2005 Hello,
- John Reimer (9/22) Apr 30 2005 D uses it's own calling convention: extern(D). It's disimilar to either...
- Kevin VR (12/36) May 03 2005 Just for someone else who might be interested in this:
- pragma (12/20) May 03 2005 From what I know, you're right on the money about D's calling convention...
- John Reimer (9/36) May 03 2005 I'm not quite sure what the details are on the calling convention nor
Hello, D has the ability to assign specific calling conventions to each function by using "extern(<convention>)". Which conventions are actually supported? I know at least 2: extern(C) -> cdecl? extern(Windows) -> stdcall? More importantly, which is the default calling convention for D? Also, a little side question, is there a way to have the DMD compiler output it's generated assembler code? (like the -S option on gcc) thanks, Kevin
Apr 30 2005
Kevin VR wrote:Hello, D has the ability to assign specific calling conventions to each function by using "extern(<convention>)". Which conventions are actually supported? I know at least 2: extern(C) -> cdecl? extern(Windows) -> stdcall? More importantly, which is the default calling convention for D?D uses it's own calling convention: extern(D). It's disimilar to either of the above, specifically in name mangling format.Also, a little side question, is there a way to have the DMD compiler output it's generated assembler code? (like the -S option on gcc)obj2asm is included with dmd's linux distribution, which should work on any d object file. The same tool is also available for win32, but, strangely, it doesn't look like Walter includes it with the basic dmd distribution. You have to purchase the extended utilities package for $15 to get it. -JJR
Apr 30 2005
Kevin VR wrote:Just for someone else who might be interested in this: I have discovered that the D compiler supports D, C, C++, Pascal and Windows as calling conventions.Hello, D has the ability to assign specific calling conventions to each function by using "extern(<convention>)". Which conventions are actually supported? I know at least 2: extern(C) -> cdecl? extern(Windows) -> stdcall? More importantly, which is the default calling convention for D?D uses it's own calling convention: extern(D). It's disimilar to either of the above, specifically in name mangling format.Can you point me to some reference where I can review the specific details of it? I have discovered by examining the .o files that D seems to push its parameters on the stack, except for the last one which seems to be put in the EAX register. I'm not an expert in this kind of stuff though, so I would like to see some kind of documentation about it. I have searched the site and google, but found nothing usefull yet.Thanks, this is a very nice tool. I use it on Linux!Also, a little side question, is there a way to have the DMD compiler output it's generated assembler code? (like the -S option on gcc)obj2asm is included with dmd's linux distribution, which should work on any d object file. The same tool is also available for win32, but, strangely, it doesn't look like Walter includes it with the basic dmd distribution. You have to purchase the extended utilities package for $15 to get it.
May 03 2005
In article <d58a9f$2k8q$1 digitaldaemon.com>, Kevin VR says...From what I know, you're right on the money about D's calling convention. The return value also seems to be EAX (although I'm not sure what happens when you return a struct). The D webpage is supposed to have this kind of documentation, but I think it's very much a work-in-progress like everything else: http://www.digitalmars.com/d/abi.html If you don't get any feedback here from Walter, I'd reccomend either emailing him or adding your findings to the D wiki's doc commments under the ABI (application binary interface). http://www.prowiki.org/wiki4d/wiki.cgi?DocComments/ABI - EricAnderton at yahooCan you point me to some reference where I can review the specificdetails of it? I have discovered by examining the .o files that D seems to push its parameters on the stack, except for the last one which seems to be put in the EAX register. I'm not an expert in this kind of stuff though, so I would like to see some kind of documentation about it. I have searched the site and google, but found nothing usefull yet.
May 03 2005
Kevin VR wrote:I'm not quite sure what the details are on the calling convention nor where to find it. :-( Personal investigation has led me to believe that D uses a very similar calling convention to either extern(C) or extern(Windows) (can't remember which one)... it seems that the D name mangling is the only obvious difference. I could be wrong.D uses it's own calling convention: extern(D). It's disimilar to either of the above, specifically in name mangling format.Can you point me to some reference where I can review the specific details of it? I have discovered by examining the .o files that D seems to push its parameters on the stack, except for the last one which seems to be put in the EAX register. I'm not an expert in this kind of stuff though, so I would like to see some kind of documentation about it. I have searched the site and google, but found nothing usefull yet.Linux :-). things seem to be a lot more straightforward on that platform when it comes to programming. -JJRThanks, this is a very nice tool. I use it on Linux!Also, a little side question, is there a way to have the DMD compiler output it's generated assembler code? (like the -S option on gcc)obj2asm is included with dmd's linux distribution, which should work on any d object file. The same tool is also available for win32, but, strangely, it doesn't look like Walter includes it with the basic dmd distribution. You have to purchase the extended utilities package for $15 to get it.
May 03 2005