Calling conventions

Bill Baxter dnewsgroup at billbaxter.com
Wed Dec 5 18:50:16 PST 2007


Mike wrote:
> Just an idea ... no feature request for D, but for the compiler :)
> 
> I've got a lot of calling conventions in my project now. The punks under 
> these calling conventions are:
> 
> * MSVC's "thiscall"
> (for talking to ASIO audio drivers)
> 
> ... and the very strange ...
> 
> * extern (Pascal) with parameters defined in reverse order
> (for talking to the graphics tablet under windows - I have no idea which 
> compiler spits out binaries like these)
> 
> With duct tape and a swiss army knife it's all doable ... but it got me 
> thinking: wouldn't it be nice to be able to define calling conventions 
> via XML or so?
> 
> <convention name="myFunkyCallingConvention">
>     <thisPtr>ECX</thisPtr>
>     <return>EAX</return>
>     <stackCleaner>callee</stackCleaner>
>     <pushOrder>left-to-right</pushOrder>
>     <align>4</align>
> </convention>
> 
> It doesn't have to be XML of course. Just a little half-readable file 
> with the definition which the compiler can use to generate the 
> appropriate calling code. And if you need it, you can just pass it to 
> DMD. DMD/DMC++ could come with a bunch of them pre-defined.
> 
> What do you think?

-real.inf on using XML for anything.

Anyway I don't really see the utility of separating the calling 
convention from the place where the function is prototyped.  You need 
both to call the function.  It's like putting the function names in one 
file and all the parameters in another file.  I don't get why that would 
be a good thing.

--bb



More information about the Digitalmars-d mailing list