How to create shared library on linux?

Li Jie cpunion at gmail.com
Sun Aug 13 11:31:38 PDT 2006


I dont know how to create a shared library using dmd or build(http://dsource.org/projects/build).

I try to compile the D source files to .o, and link them:
# dmd -c *.d
# gcc -o Test.so -shared *.o -lphobos

I get som errors:
...ld: Test.so: undefined versioned symbol name _d_throw at 4
...ld: failed to set dynamic section sizes: Bad value
collect2: ld returned 1 exit status

Other questions:
1.
How to link a shared library in dmd? I have a shared library, named libtest.so.
In gcc, I can do this:
# gcc -o test test.c -ltest
In dmd, I don't know how to do that.

2.
On linux, where do I place the gc code? Like DllMain, See "http://digitalmars.com/d/dll.html".



More information about the Digitalmars-d-learn mailing list