rendered paste bodytrunk $cat Makefile
all: test
test: main.d libmyshared.bundle
gdc -c main.d -I.
gdc -o test main.o -lpthread -lm -ldl -L. -mylibrary
run:
./test
libmyshared.bundle: mylibrary.d
gdc -dynamic -bundle -flat_namespace -fno-common -g -O2 -pipe -o libmylibrary.bundle mylibrary.d -ldl
clean:
-rm -f *.o
-rm -f test
-rm -f *.so
trunk $cat mylibrary.d
module mylibrary;
int boe()
{
return 11;
trunk $cat main.d
module myapplication;
import mylibrary;
import std.stdio;
int main()
{
writefln("Shared Library Test");
writefln(boe());
return 0;
}
trunk $make
gdc -dynamic -bundle -flat_namespace -fno-common -g -O2 -pipe -o libmylibrary.bundle mylibrary.d -ldl
gdc -c main.d -I.
gdc -o test main.o -lpthread -lm -ldl -L. -mylibrary
/usr/bin/ld: Undefined symbols:
__D9mylibrary3boeFZi
collect2: ld returned 1 exit status
make: *** [test] Error 1
trunk $