What is the right way to link static and shared libraries togethe r?

Alexandre Oliva aoliva@redhat.com
Thu Jul 10 17:10:00 GMT 2003


On Jul 10, 2003, Joerg.Richter@pdv-FS.de wrote:

> LINK -shared B.o -o libB.so -lA
> LINK C.o -o C -lB

> I like the second one better, cause you build a self contained shared
> library B. And the executable can link with B without knowing library A.

However, if library A contains non-PIC, it is possible that library B
fails to link, or is silently broken.  On some platforms, you just
can't link non-PIC into shared libraries.  On others, you can, even if
with a run-time penalty.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer



More information about the Binutils mailing list