Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert shared library to static library?

Tags:

c++

c

Is it possible to convert a shared library (someLib.so) to a static library? (someLib.a)

like image 714
Stelmate Avatar asked Jun 10 '11 06:06

Stelmate


People also ask

How can static library lib1 be converted into a shared library without breaking references?

Rename the static library so that you can use the old name for the new shared library. Right-click the static library, click Rename, and enter a name. Rename the shared library so that it has the old name of the static library. By renaming the shared library, broken project references are fixed.

What is the difference between static library and shared library?

Static libraries take longer to execute, because loading into the memory happens every time while executing. While Shared libraries are faster because shared library code is already in the memory. In Static library no compatibility issue has been observed.

Can you statically link a dynamic library?

You can't statically link a shared library (or dynamically link a static one).

Is a shared library a dynamic library?

Dynamic and shared libraries are usually the same. But in your case, it looks as if you are doing something special. In the shared library case, you specify the shared library at compile-time. When the app is started, the operating system will load the shared library before the application starts.


1 Answers

No. (At least for ELF shared library). A shared library is a simple object (so stands for shared object). A static library is a collection of objects. In the process of building the shared library you combine several objects and you lose some of the information which would be needed to retrieve them.

like image 169
AProgrammer Avatar answered Sep 22 '22 12:09

AProgrammer