#!/bin/sh # Creating a shared library goes a little like this: # You have a file "test.d" that you want to turn into a shared library. # You need the object file, so you run gdc -c -fPIC testlib/test.d # and it spits out "test.o". # You need a shared object, so you run gcc -shared -Wl,-soname,libtest.so.1 -o libtest.so.1.0.1 test.o # and it spits out "libtest.so.1.0.1". # You now have a library archive and a shared object; this means that you can now build your main project. # To build your project, run gdc main.d -o main libtest.so.1.0.1 mv libtest.so.1.0.1 libtest.so.1 LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH ./main