C++/D class interop example crashes

bachmeier no at spam.net
Sat Mar 27 20:28:50 UTC 2021


On Saturday, 27 March 2021 at 18:39:53 UTC, Bastiaan Veelo wrote:

> The example links objects statically. You may be experiencing 
> additional challenges with crossing DLL boundaries. I have not 
> yet used DLLs, but did you initialise the D runtime?
>
> — Bastiaan.

This is an example taken from the documentation. It should work 
out of the box.

I tried with LDC (don't have dmd on this computer) and I got this 
error:

/usr/bin/ld: base.o: undefined reference to symbol '_d_allocclass'
/usr/bin/ld: /usr/lib64/libdruntime-ldc-shared.so.90: error 
adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

Given that someone interoperating with C++ probably cares about 
performance, it should also work out of the box with LDC, or at 
least tell you the changes that need to be made. I'll open an 
issue in the bug tracker when I return home (traveling now) if 
someone else doesn't.


More information about the Digitalmars-d-learn mailing list