compile error while use `extern(C++, class)`

Lodovico Giaretta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Aug 18 03:45:14 PDT 2016


On Thursday, 18 August 2016 at 01:06:29 UTC, mogu wrote:
> From spec (Interfacing to C++) 
> https://dlang.org/spec/cpp_interface.html:
>
> ```
> When mapping a D class onto a C++ struct, use extern(C++, 
> struct) to avoid linking problems with C++ compilers (notably 
> MSVC) that distinguish between C++'s class and struct when 
> mangling. Conversely, use extern(C++, class) to map a D struct 
> onto a C++ class.
> ```
>
> But this compiles error. Please help, thanks.

Which kind of error? An error message by the compiler? One by the 
linker? The compiler crashes?

If you don't tell us what happens exactly, and a simple example 
code that triggers the issue, we don't know what to do.

If your codebase is big and you don't manage to reduce it to a 
couple lines to show the error, you can try dustmite [1].

[1] https://github.com/CyberShadow/DustMite/wiki


More information about the Digitalmars-d-learn mailing list