On Wednesday, 15 December 2021 at 12:36:49 UTC, evilrat wrote:
You probably know this but just in case - unlike C++ in D
variables by default have thread local storage, to link with
C++ global variable you need to use __gshared storage modifier
in D, it is similar to 'shared' variable that unlike 'shared'
tells the compiler "I know how to synchronize it myself".
```d
module a;
struct Foo {}
extern(C++)
__gshared Foo globalFoo;
```
Yeah, did that. As I said the mangled name that DMD chose is
correct.
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.