On Saturday, 27 March 2021 at 21:50:19 UTC, Jan wrote:
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?

I haven't done anything extra (I'm pretty new to D). Do you mean calling this from the D code before using writeln?
https://dlang.org/phobos/core_runtime.html#initialize

I would have thought that happens automatically anyway.

It should be in this case since the D code in the example is an application with a D main. The compiler will generate an extern(C) main that initializes the runtime and calls your D main. You have to initialize the runtime manually in three cases: you implement an extern(C) main yourself, you use WinMain instead of main, or you implement a shared library in D.

The problem most likely has to do with your use of a DLL rather than linking statically as in the example. D interfaces with C DLLs just fine, but given that C++ compatibility is limited, I would expect issues when interfacing with C++ DLLs.

Reply via email to