Calling conventions
Mike
vertex at gmx.at
Wed Dec 5 17:22:41 PST 2007
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?
-Mike
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
More information about the Digitalmars-d
mailing list