Dynamic D Library

Jesse Phillips jessekphillips at gmail.com
Thu Jul 16 23:15:18 PDT 2009


On Fri, 17 Jul 2009 01:35:37 -0400, teo wrote:

> Hmm, you say it is working. Can you show me how to do that on 32-bit
> Linux with dmd? How would you compile Phobos as an external library?
> Please let me know, if you are aware of an article describing that.
> Thank you in advance.

My guess is that you should be able to follow a shared library tutorial

http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html

Then just modify the GCC commands for DMD

gcc -Wall -fPIC -c *.c

Becomes:
dmd -fPIC -c *.d

Probably can leave alone:
gcc -shared -Wl,-soname,libctest.so.1 -o libctest.so.1.0   *.o

gcc -Wall -L/opt/lib prog.c -lctest -o prog

Becomes:
dmd -L-L/opt/lib prog.d -L-lctest

I have not tested this, but nor have I got it to work in C, but I only 
blame myself.



More information about the Digitalmars-d mailing list