Can't use a C++ class from a DLL

Daniel Murphy yebblies at nospamgmail.com
Mon Oct 29 07:01:02 PDT 2012


"Artie" <apple2000 at mail.ru> wrote in message 
news:uhdpnavdyokxigczlxto at forum.dlang.org...
>
> BTW, it's said in the ABI reference that `unsigned long` must be 
> substituted with `uint`. And it seems to work fine for the data I used in 
> the example.

unsigned int and unsigned long are the same size in 32 bit C/C++, but are 
mangled differently when using C++ name mangling.  unsigned long may not be 
32 bits on all platforms, so to portably match the size used by the native 
C/C++ compiler you should use the c_ulong aliases.
The problem with name mangling is avoided in this case as you're not using 
C++ name mangling, you're using stdcall name mangling, which only keeps 
track of argument sizes, not their types. 




More information about the Digitalmars-d mailing list