Hi everyone,
I'll cut to the chase - is it ok to include -fPIC compiling C code to be
included in a static library?
Now the background:
I have a (largish) software package that I maintain that I'd like to
build a shared library out of. The current build process builds a bunch
of static libraries, and then compiles and links the main executable
against them to generate the runnable binaries. I want to take these
static libraries, and combine them all into one shared library. I don't
necessarily want to change the build process for the software package
(i.e. I still want the generated binaries statically linked), but I want
to make the contents of the static libraries available via a shared library.
I am using Linux (Currently CentOS 5) and GCC 4.1.2. I've changed the
Makefiles to include -fPIC and built the software. Everything builds and
appears to work properly. I then take the static libraries (that were
compiled with -fPIC and created with ar) and take them apart (with ar)
and use gcc -shared to create a static lib. This all seems to work fine.
Did I explain this sufficiently?
Thanks for any and all insight!
Tim