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

Artie apple2000 at mail.ru
Mon Oct 29 07:42:30 PDT 2012


On Monday, 29 October 2012 at 14:01:09 UTC, Daniel Murphy wrote:
> "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.

That makes sense. I was unaware of such details. Thanks a lot.


More information about the Digitalmars-d mailing list