开发者

method of converting a static library into a dynamically linked library

If all I have of a library is a *.a static library. Is there a way I can convert that to *.so dynamically linked library? Maybe using ld?

I'm using SUSE Linu开发者_如何学运维x. ELF platform.


This command will attempt to do what you want:

gcc -shared -Wl,--whole-archive library.a -o library.so

But if your library wasn't compiled with -fpic/-fPIC, which it probably wasn't, it won't work (it might appear to work, but you don't get any of the benefits of shared libraries).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜