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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With