Linking against a Win32-DLL

torhu fake at address.dude
Tue Jul 10 08:46:36 PDT 2007


Marc Müller wrote:
> > Do you know a calling convention or compiler/linker switch to tell D to 
> > let the callee clean up the stack like in extern(Pascal), but push the 
> > parameters in reverse order on the stack?
> > 

Sounds like you're describing stdcall.

You could use extern (Pascal) only to be able to link with the symbol,
then assign the address of the function to an extern (Windows) pointer,
and call it through that.  This is all in theory, of course.

---
typedef extern (Windows) UINT function(UINT , UINT , LPVOID) WTInfoA_type;

extern (Pascal) UINT WTInfoA(UINT , UINT , LPVOID);

WTInfoA_type WTInfoA_ptr;

void main()
{
    WTInfoA_ptr = cast(WTInfoA_type)&WTInfoA;
    WTInfoA_ptr(/* args here*/);
}
---

Untested code, but it looks plausible.



More information about the Digitalmars-d mailing list