Reputation: 2796
I have both static and dynamic versions of the same library installed on my Linux system:
/usr/lib/libsample.a
/usr/lib/libsample.so
Which one of these libraries will use gcc, if I set argument -lsample ?
gcc xxx.c -lsample
How can I force gcc to use static or dynamic version of the library
Upvotes: 13
Views: 7328
Reputation: 639
http://www.rapidtables.com/code/linux/gcc/gcc-l.htm
You don't have to do anything, dynamic is the default.
However, it has to add a couple of things to the binary to help it, at runtime, to properly use the dynamic library.
Upvotes: 8