C++ interop - what to do about long and unsigned long?

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 10 13:40:59 PDT 2014


C++'s long and unsigned long can be accessed with c_long and c_ulong. 
Unfortunately, these are aliases and mangle to their underlying types.

Meaning that there is no way to interface to a C++ function declared as:

     void foo(unsigned long);

So, what to do about this?

1. elevate c_long and c_ulong into full fledged types.

2. create full fledged types __c_long and __c_ulong, and alias c_long and 
c_ulong to them.

3. some sort of attribute?

The same issue exists for C++'s 'long double'.


More information about the Digitalmars-d mailing list