how to force linker to use shared library instead of static library?
You could use -l
option in its form -l:filename
if your linker supports it (older versions of ld
didn't)
gcc -o app app.o -L. -l:libtest.so
Other option is to use the filename directly without -l
and -L
gcc -o app app.o /path/to/library/libtest.so
from the man :
-shared-libgcc
-static-libgcc
On systems that provide libgcc as a shared library, these options force the use of either the shared or static version respectively. If no shared version of libgcc was built when the compiler was configured, these options have no effect.
good luck