Method to convert a static library to a dynamically linked library

If I have a library, this is a * .a static library. Is there a way I can convert to a * .so dynamically linked library? Maybe ld?

I am using SUSE Linux. ELF platform.

+3
source share
1 answer

This command will try to do what you want:

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

But if your library was not compiled with -fpic/ -fpic, which probably was not, it will not work (it may work, but you do not get any benefits of shared libraries).

+6
source

Source: https://habr.com/ru/post/1769254/


All Articles