Calling conventions

Mike vertex at gmx.at
Thu Dec 6 17:47:12 PST 2007


On Fri, 07 Dec 2007 01:12:37 +0100, Bill Baxter  
<dnewsgroup at billbaxter.com> wrote:

> Bummer.  As might be expected, Microsoft's C/C++ compilers understand  
> the calling convention (I think it comes from old windows 3.0 days).  So  
> I didn't encounter any difficulties with the original version of  
> bbTablet.  But if I ever get the chance I would definitely like to  
> overhaul it for D (or actually give it a C API so that I can wrap it up  
> for both D and Python use).  And that's why I asked you in my first  
> message of this thread to describe what you had to do to call the wintab  
> functions.  Still interested in knowing that, BTW.

In C:

UINT API WTInfoA(UINT wCategory, UINT nIndex, LPVOID lpOutput);

In D:

extern (Pascal) typedef UINT function(void *lpOutput, UINT nIndex, UINT  
wCategory) WTInfoFunc;

Give it extern (Pascal) and reverse the definition of the arguments.

> On the other hand, if you've gotten something in D working, and are  
> willing to share, I'd be happy to use that.  Are you going to make your  
> tablet code available?

Can do. But it'll take some time - I'm planning to release a GUI-less  
proof-of-concept-release of my VST host in about two weeks, after that  
I'll work on the Wintab bindings again.

> I believe (but have no good evidence) that there are few enough actual  
> calling conventions in use that it would be smarter in the long run to  
> just make the compiler understand them all rather than creating a  
> do-all, ultimately flexible, user-configurable system where 99.9% of all  
> users will only use the built-ins anyway.

Hmm. Maybe you're right. thiscall and the "Pascal reversed" one are the  
only ones I've seen that aren't supported by DMD.

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



More information about the Digitalmars-d mailing list