How to create shared library on linux?
clayasaurus
clayasaurus at gmail.com
Sun Aug 13 17:39:40 PDT 2006
Li Jie wrote:
> 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
>
DMD can not create shared libraries on linux yet, but GDC can.
>
> 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.
On linux, DMD uses GCC as its linker so you'd just do something like...
dmd file.d -L-ltest
If I remember correctly. Or
dmd -c file.d
gcc file.o -o file -ltest
More information about the Digitalmars-d-learn
mailing list