Calling conventions

Mike vertex at gmx.at
Thu Dec 6 10:18:02 PST 2007


On Thu, 06 Dec 2007 18:26:24 +0100, Bill Baxter  
<dnewsgroup at billbaxter.com> wrote:

> I don't know much about calling conventions.  Are tehre really that many  
> out in the wild?  If DMD doesn't support some of the ones that are in  
> use, maybe the more reasonable thing would be to just add those.

Didn't you encounter that problem with bbTablet? Maybe the C++ compiler  
you used knows that calling convention. If you decide to port bbTablet do  
D, you'll be unpleasently surprised.

I have no idea how many calling conventions there are - but since it's  
pretty arbitrary how you pass the arguments I figure there are lots of  
them, just few popular ones. A quick and certainly wrong Wikipedia search  
gave me 15 for x86 only. A way to define the ABI (maybe name mangling as  
well) would solve the problem once and for all. Put up a project on  
dsource where ABI definitions are hosted and everybody can submit anything  
they encounter in the wild. Any compiler, any weird embedded processor,  
everything.

Maybe it'll be possible with macros, I don't know. Maybe something like

pragma(abi, "thiscall")
{
     void opCall(this, param1, param2)
     {
          // here be assembler code for any calls with a this pointer and 2  
parameters
     }
}

would be good.

-Mike

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/



More information about the Digitalmars-d mailing list