开发者

method of converting a static library into a dynamically linked library

开发者 https://www.devze.com 2023-01-20 10:51 出处:网络
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?

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

精彩评论

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