gcc linker library search order; paths plus static vs shared

回眸只為那壹抹淺笑 提交于 2019-12-04 07:18:30

In your example, the static library libmylibrary.a will be linked in preference to any libmylibrary.a or libmylibrary.so that might exist in one of the linker's default search directories. The linker searchs in mypath before any of the default places, and as soon as it finds a libmylibrary.a or libmylibrary.so, it looks no further to satisfy -lmylibrary.

If mypath contained both libmylibrary.a and libmylibrary.so, the latter would be preferred.

I am not sure what source you are referring to by "the gcc manual", but "the gcc linker" is the GNU linker, ld, and you will find the meanings of the commandline options very well explained in its manual

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!