D2.0 cpp interfacing: what is a C++ unsigned long counterpart in D?

Denis Koroskin 2korden at gmail.com
Sat Oct 3 13:00:41 PDT 2009


On Sat, 03 Oct 2009 22:47:53 +0400, Walter Bright  
<newshound1 at digitalmars.com> wrote:

> Denis Koroskin wrote:
>> I'm currently writing a program that interfaces with C++.
>> C++ code uses a lot of 'unsigned long', which equals to 'unsigned int',  
>> or just 'unsigned', but is mangled differently.
>>  In particular, C++ mangles unsigned long as 'K', and I can't find a D  
>> counterpart that would be mangled similarly.
>> This results in an unaccessible function (it is unresolved at link  
>> time).
>>  Any thoughts?
>
> The problem is there is no way to express in D both an unsigned and an  
> unsigned long, since they are both uints in D. I don't know of a way  
> around this, other than changing the C++ code.

That's not always possible. Imagine LGPL'd code, or code which is  
distributed in precompiled form only (header + library).



More information about the Digitalmars-d mailing list