[D-runtime] DLL initialization in Druntime

Rainer Schuetze r.sagitario at gmx.de
Tue Jan 18 11:37:00 PST 2011


Sean Kelly wrote:
> The unfortunate part is that this isn't necessary when using Runtime.loadLibrary(), since that will do the right thing.  It would only be necessary for a non-D hosting app.  I guess if it has an "already ran" flag in it then the library writer could have his init_my_lib() routine call it instead.  *sigh*  No automatic alternatives, huh?

What about creating a DLL that just contains the GC and exports the 
proxy pointer? Any DLL/EXE that wants to use the shared GC links against 
the import library of this DLL and sets its proxy pointer before any 
other initialisation.

In case of multi threading, a bit more needs to done to forward TLS 
ranges to the proxy. But this will probably not work anyway, because the 
threads also need to be shared.

So, better create a druntime.dll/phobos.dll to share everything...

Rainer



More information about the D-runtime mailing list