how to link shared library against other shared li

2020-06-04 12:37发布

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条回答
ら.Afraid
2楼-- · 2020-06-04 13:01

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
查看更多
登录 后发表回答