[Issue 12792] New: runtime loading D shared library as a standalone (with it's own GC etc)
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri May 23 14:14:54 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12792
Issue ID: 12792
Summary: runtime loading D shared library as a standalone (with
it's own GC etc)
Product: D
Version: unspecified
Hardware: Other
OS: Linux
Status: NEW
Keywords: dll
Severity: enhancement
Priority: P1
Component: druntime
Assignee: nobody at puremagic.com
Reporter: code at dawg.eu
Reported by Timothee Cour on the newsgroup.
http://forum.dlang.org/post/mailman.322.1393449436.6445.digitalmars-d-learn@puremagic.com
main.d:
call a D shared library via dlopen/dlsym
foo.d:
extern(C) void foo(){
printf("inside_foo\n"); //ok
import core.runtime;
bool ret=Runtime.initialize();//will segfault below with or without that
assert(ret);//ok
int[]a;
a.length=2;//segfault
}
dmd -g -oflibfoo.dylib -shared foo.d
dmd -g -oftest main.d
./test
#Loading shared libraries isn't yet supported on OSX.
#inside_foo
#segfault at first occurence of gc (a.length=2 above)
under lldb:
* thread #1: test D2rt12sections_osx9tlsOffsetFPvZm + 109, stop reason =
EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
frame #0: test D2rt12sections_osx9tlsOffsetFPvZm + 109
frame #1: test __tls_get_addr + 20
frame #2: libfoo.dylib _d_arraysetlengthT + 3701
--
More information about the Digitalmars-d-bugs
mailing list