Interfacing D to existing C++ code
Paolo Invernizzi via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Fri Jan 30 00:34:33 PST 2015
On Friday, 30 January 2015 at 04:08:56 UTC, Daniel Murphy wrote:
> "Walter Bright" wrote in message
> news:maed4o$2da6$1 at digitalmars.com...
>
>> >
>> > So constructors and destructors are mangled 'a la D' instead
>> > of the C++ way.
>>
>> Please post this to bugzilla.
>
> The problems with constructors go beyond mangling, so the
> current forced D mangling is intentional to prevent wrong-code
> bugs.
>
> An approach that currently works is porting the code to D,
> being careful to exactly match the layout and functionality.
> When done right, this allows templated types to be constructed
> with any type in either language and passed back and forth
> without problems.
>
> This is what I've done for dmd's Array<T> in ddmd.
I've done the same for some matrix ctor of opencv: it's a pain
but works...
The main problem I've found right now it's that sometime I'm
forced to choose a struct in D mapping a class in C++ just to
have the right mangling for const ref methods...
More information about the Digitalmars-d-announce
mailing list