Is the default gcc link program with a static or dynamic library?

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 of these libraries will gcc use if I specify the -sample argument?

 gcc xxx.c -lsample 

How to force gcc to use the static or dynamic version of the library

+7
c ++ c gcc linux linker
source share
1 answer

http://www.rapidtables.com/code/linux/gcc/gcc-l.htm

You do not need to do anything, dynamic by default.

However, it should add a couple of binaries to help the runtime use the dynamic library properly.

+5
source share

All Articles