Static libraries vs shared Libraries
Hi
I have a third party static library (libSTATIC.a) that I cannot recompile into a shared library. I want to create a shared library (libSHARED.so) that uses the C functions in the static library. Is it possible to do this? In other words, when linking a C program with gcc by using the -shared flag, is it necessary that all all libraries invoked in the program (even low level libraries such as libc for example) be available as shared libraries as well? Thanks a lot. |
Yes, you can mix and match shared and static libraries in the same link command.
Under the circumstances, that's probably the best approach here. Just use your static library as-is; don't bother trying to convert it to a shared library. IMHO .. PSM PS: "gcc --help" will show you all the command line options available to you. |
Does the converse hold as well? In other words, if we have a
shared library libSHARED.so which we cannot modify, can we create a static library libSTATIC.a which used the functions in libSHARED.so? If yes, does gcc embed the code from libSHARED.so in libSTATIC.a, or is it necessary that libSHARED.so be installed in the system for the functions in libSTATIC.a to work properly at runtime? |
All times are GMT -5. The time now is 12:18 AM. |