C++ interop - class vs struct

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Thu Sep 11 00:51:53 PDT 2014


On 9/10/14, 11:32 PM, Daniel Murphy wrote:
> "Walter Bright"  wrote in message news:luqd60$2u0r$1 at digitalmars.com...
>
>> C++ name mangling distinguishes between a class and a struct. This
>> distinction has no semantic meaning, but there it is in the name
>> mangling. In order to
>> interop, we have to have a way to tell D to mangle a struct as a
>> 'class' when interfacing with C++.
>>
>> I have some ideas, but they're all kinda ugly.
>>
>> Any ideas?
>
> pragma(cpp_mangle_as_struct)
> class Foo
> {
> }
>
> This is a low-level feature, and should be ugly.

I think attributes would be the go-to approach. -- Andrei


More information about the Digitalmars-d mailing list