DMD dll GC bug when calling a function from an interface that creates a new object

Adam D Ruppe destructionator at gmail.com
Thu Nov 3 12:33:17 UTC 2022


On Thursday, 3 November 2022 at 04:38:28 UTC, cc wrote:
> D DLLs each operate under a separate GC context from the main 
> process, so anything `new`ed in a DLL may be collected if a 
> reference to it isn't maintained there.  You can link them 
> together so they share the same GC with something like this:

This is only true on dmd windows (with ldc, you get a shared 
druntime to all mixed) and you don't have to set the proxy 
yourself - Runtime.loadLibrary does it for you.

But do make sure you are using Runtime.loadLibrary! SimpleDllMain 
alone i don't think does it.... so this might be hipreme's 
problem.

> Source: http://arsdnet.net/dlang.org/dll.html

This is an old copy of the website newer info on the d wiki.


More information about the Digitalmars-d mailing list