[Issue 10775] druntime is not set up to handle dynamically loaded shared libraries in linux
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Jul 24 16:53:59 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=10775
Martin Nowak <code at dawg.eu> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |code at dawg.eu
Resolution|--- |WORKSFORME
--- Comment #1 from Martin Nowak <code at dawg.eu> ---
This was implemented by
https://github.com/D-Programming-Language/druntime/pull/593
(https://github.com/D-Programming-Language/druntime/commit/73d067fd04ed8c9588c5ae09ebe48fdb1b528793).
Works for me, I had to change dlopen("libdll.so", RTLD_LAZY) to
dlopen("./libdll.so", RTLD_LAZY) though.
+main()
libdll.so construction
libdll.so is loaded
dll() function is found
dll()
unloading libdll.so
libdll.so destruction
-main()
Note: It's better to use Runtime.load/unloadLibrary [¹] instead of
dlopen/dlclose b/c then we can run the TLS ctors/dtors without holding the
loader lock, thus avoiding a common source of deadlocks and reducing possible
contention.
[¹]: http://dlang.org/phobos/core_runtime.html#.Runtime.loadLibrary
rt_loadLibrary or core.runtime.Runtime.loadLibrary.
--
More information about the Digitalmars-d-bugs
mailing list