Compiling a mixed D and C++ project?

Kyle De'Vir kyle.devir at mykolab.com
Tue Sep 3 08:18:07 UTC 2019


On Tuesday, 3 September 2019 at 07:49:44 UTC, Manu wrote:
>
> C++ classes or structs with vtables are the same as D classes. 
> C++
> classes or structs without vtables are the same as D struct.
> In this case, you should be using a D `extern(C++) class` so 
> that it
> matches the C++ code.
> If you try exactly what I wrote, it might work better.
>
> And you should use extern(C++) everywhere instead of extern(C),
> otherwise you won't know when you've made mistakes that cause
> segfaults. C declarations don't carry argument types, to 
> extern(C)
> can't tell you when functions don't match.

Thanks for the advice. I'll give it a shot, then.

I was avoiding using extern C++ because I was unsure about the 
status of Dlang's C++ interoperability, given how silly C++'s ABI 
incompatibilities can be.


More information about the Digitalmars-d mailing list