On 2012-02-24 23:37, Ellery Newcomer wrote:
So I'm all trying out this hot new shared switch, and it works just dandy for -m32 when d has the main function. But now I want to be able to call my shared lib from C.my little shared lib, tup.d: import std.stdio; extern(C) void xyz(int i){ writeln(i); } compiled like so: dmd -shared -m32 tup.d -oflibtup.so my little C program, tok.c: extern void xyz(int); int main(int argc, char **argv){ xyz(1); } compiled like so: gcc -m32 tok.c -L. -ltup Oh no! ./libtup.so: undefined reference to `_deh_beg' ./libtup.so: undefined reference to `_tlsend' ./libtup.so: undefined reference to `_tlsstart' ./libtup.so: undefined reference to `_deh_end' collect2: ld returned 1 exit status It seems like I've run into this before with static libs, but I'll ask again anyways. What the heck are these symbols for?
_deh_beg and _deh_end is the start and end of the exception handling tables. _tlsstart and _tlsend would be the start and end of the TLS data. As far as I know druntime has not yet been adapted to handle dynamic libraries.
I think there's a pull request that fixes this. -- /Jacob Carlborg
