Repository navigation
core.runtime.Runtime.loadLibrary & unloadLibrary missing #24003
Replies: 4 comments 2 replies
|
that function is only available of using the shared lib druntime. |
|
For Posix targets, this is only available with the shared druntime, otherwise you get the pretty ugly/unclear undefined On Windows however (where DMD still doesn't ship a shared lib AFAIK), this function is available with static druntime. And makes the GC in the loaded DLL's druntime be a proxy to the main application's, so as to have a single GC. So I guess the (incomplete) documentation comes from that angle. I can only discourage using multiple statically linked druntimes in a single process though. It can work if you know exactly what you are doing and avoid all potential pitfalls (like each druntime only knowing about the threads it spawned, for GC scanning, GC pausing etc. etc.), but that's usually hard. Linking every D binary to a single shared druntime/Phobos as documented in https://dlang.org/articles/dll-linux.html#dso10 ( |
|
Can I be confident that Runtime.loadLibrary works as documented when I link with a shared druntime, but dynamically load a shared object that has a static druntime? |
|
Well, it seems this omission from the static library is a bug. |
Uh oh!
There was an error while loading. Please reload this page.
https://dlang.org/phobos/core_runtime.html#.Runtime.loadLibrary
If these are used so as to reconcile D runtime with dynamic loading there's a linkage error with dmd. (Works with gdc.)
This is a bug, right? Is this unimplemented?
Any information about what's going on gratefully received.
R.
All reactions