开发者

gcc linker finding both .so and .a in the library path which is chosen?

开发者 https://www.devze.com 2022-12-25 06:32 出处:网络
If I run gcc a.c -L /usr/lib -lexpat and both libexpat.a and libexpat.so are in /usr lib which one is u开发者_如何学Gosed by the linker?By default the shared library (.so) will be chosen.

If I run

gcc a.c -L /usr/lib -lexpat 

and both libexpat.a and libexpat.so are in /usr lib which one is u开发者_如何学Gosed by the linker?


By default the shared library (.so) will be chosen.

If you want to change this behavior, -static gcc option may be used

-static

On systems that support dynamic linking, this prevents linking with the shared libraries. On other systems, this option has no effect.

0

精彩评论

暂无评论...
验证码 换一张
取 消