[Issue 24427] Crash when dlopen'ed library not dlclose'd explicitly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 1 22:54:36 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=24427

--- Comment #10 from Carl Sturtivant <sturtivant at gmail.com> ---
(In reply to Richard Cattermole from comment #9)
> The default phobos/druntime shared/static may depend upon platform and
> distribution.

I used the --link-defaultlib-shared=true option which I assume also shares
druntime. I found no switch mentioning sharing or statically linking druntime
explicitly.

Neither main.c nor dynamic_lib.c will link with --link-defaultlib-shared=true
With that false, the C version just works.

By contrast, D source links for all four combinations of true/false for
--link-defaultlib-shared for each build. Three work, one crashes.
====
$ ldc2 -c main.d
$ ldc2 -of=main -L-E main.o -L-ldl --link-defaultlib-shared=false
$ ldc2 -c --relocation-model=pic dynamic_lib.d
$ + ldc2 -of=dynamic_lib.so -shared -relocation-model=pic dynamic_lib.o
--link-defaultlib-shared=true
$ main
Aborting from rt/sections_elf_shared.d(605) Only one D shared object allowed
for static runtime. Link with shared runtime via LDC switch
'-link-defaultlib-shared'.Aborted (core dumped)
====

--


More information about the Digitalmars-d-bugs mailing list