views:

30

answers:

1

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 Linux. ELF platform.

+2  A: 

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).

Zack
it's good to put `-Wl,-no-whole-archive` after the list of libraries you want to include in this way
Dmitry Yudakov