how to link shared library against other shared library in linux?

你。 提交于 2019-12-21 02:25:06

问题


My application dynamically loads liba.so (with dlopen).
liba.so uses libb.so so I want to link liba.so against libb.so. How to do this in Linux?

Thanks in advance.


回答1:


If you build liba.so yourself, you need to link it with -l option

gcc -o liba.so liba.o -L/libb/path -lb

If you don't have liba sources, perhaps you could create libawrapper.so linked against liba and libb and to load dynamically this library

gcc -o libawrap.so -L/liba/ -L/libb/ -la -lb


来源:https://stackoverflow.com/questions/3625836/how-to-link-shared-library-against-other-shared-library-in-linux

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