Extract static object from dynamic one

Brian Dessent brian@dessent.net
Tue Dec 4 13:05:00 GMT 2007


Tom Browder wrote:
> 
> On Dec 3, 2007 5:21 PM, Thomas Köppe <t.koeppe@ed.ac.uk> wrote:
> ...
> > Suppose I have a dynamic C library libfoo.so (or foo.dll) along with
> > headers in foo.h. Is it possible to build from the binary a static
> > library libfoo.a?
> 
> I believe GNU libtool can be used to do that.  Check out the docs at

Libtool is useful for creating both shared and static at the same
(build) time, but it won't let you create a static library from an
already linked shared library.  There is no way to do that, as far as I
know.  You need to recompile from source.

Brian



More information about the Gcc-help mailing list