digitalmars.D - Caller of dynamic library crashes with SIGSEV if D code allocates
- Gabor Mezo (36/36) Dec 14 2014 Hello,
- Gabor Mezo (7/7) Dec 14 2014 I's solved by ketmar:
- Martin Nowak (1/5) Dec 14 2014 Don't forget to link against libphobos2.so using -defaultlib=libphobos2...
Hello, I've opened an other thread for this, because this is a different issue. Previous issue is there: http://forum.dlang.org/thread/zzjeajhjpzhnvgxquluu forum.dlang.org#post-vuzttuewxyvuihubgtas:40forum.dlang.org The current issue is if I build a dynamic library with DUB and call externals form another application, and my D code allocates anything on heap, the calling process crashes with SIGSEV. I mean it works: extern (C) { int ping() { return 555; } } But it doesn't: extern (C) { int ping() { try { throw new Exception("foo"); } catch (Exception ex) { } return 555; } } or this one crashes too: extern (C) { int ping() { auto foo = new Object(); return 555; } }
Dec 14 2014
I's solved by ketmar: "did you called `rt_init()` for your dynamic library? you have to do that in the calling process. and don't forget to call `rt_term()` on exiting." Yea, I missed that. It works. Thanks.
Dec 14 2014
The current issue is if I build a dynamic library with DUB and call externals form another application, and my D code allocates anything on heap, the calling process crashes with SIGSEV.Don't forget to link against libphobos2.so using -defaultlib=libphobos2.so.
Dec 14 2014