How to create shared library on linux?
Anders Runesson
anders at runesson.info
Mon Aug 14 05:42:11 PDT 2006
sön 2006-08-13 klockan 18:31 +0000 skrev Li Jie:
> 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
Try adding the -fPIC flag, like so:
gcc -o libTest.so -shared -fPIC *.o -lphobos
don't forget that libraries need to be named libMyLibName.so for the
linker to find them. (Note the "lib" in the beginning of the file name)
/Anders
More information about the Digitalmars-d-learn
mailing list