Shared libraries are usually loaded after a program starts running. If
you are using gcc (the Gnu Compiler Collection), you can add a path to
the directory where you can find a shared library such
libsome.so, use the compiler flag
as shown in the following makefile
DIR=/arbitrary/directory/somewhere LDFLAGS=-Wl,--rpath -Wl,$(DIR) some: some.c gcc -o $@ some.c -L $(DIR) -l some $(LDFLAGS)to compile the output so that at runtime it looks in
libsome.solibrary. Note here the
-Wlflag is a wrapper which tells the compiler to pass the following thing directly to the linker.