On Wednesday, 15 December 2021 at 15:20:18 UTC, Jan wrote:
As I was told linking against functions in DLLs works perfectly, because it is identical to static linking. Linking against global/static variables supposedly differs and that's not handled correctly for DLLs. As I said, I talked to someone who worked on fixing lots of those issues a while ago and he immediately knew about this limitation.

I have used global variables from DLLs successfully. DMD now also has a test for C++ DLLs: https://github.com/dlang/dmd/blob/master/test/dshell/extra-files/dll_cxx/testdll.d

The variable should be declared like this in C++:
__declspec(dllexport) int value;

It can then be accessed from D with this:
extern (C++) export extern __gshared int value;

Do you have a test case for your problem?

Reply via email to