开发者

What's the difference between "gcc -lname" and "gcc libname.so ..."

It 开发者_JAVA技巧seems to me that both work, any difference?

Does gcc libname.so ... statically links libname.so or not?


gcc -l looks for both static and dynamic libraries (unless -static is given) in its library search path. gcc ... libname.so links dynamically with libname.so in the current directory.


gcc ... libname.so is the same as gcc -shared -L. -lname


You can't statically link a dynamic library. You're just playing with two different ways to give the name of the library to the compiler driver program (gcc). larsmans is right that the -l option will look for both shared and then static libraries (unless you specify -static on the gcc call.)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜