#!/bin/bash gcc -c -Wall -Werror -fpic foo.c gcc -shared -o libfoo.so foo.o gcc -c -Wall -Werror -fpic boo.c gcc -shared -o libboo.so boo.o gcc -L. -Wall -o test main.c -lfoo -lboo export LD_LIBRARY_PATH=. ./test ldd test