creating shared object

Alexandre Oliva aoliva@redhat.com
Fri Nov 10 10:59:00 GMT 2000


On Nov 10, 2000, "Eerden, Jense van der" <Eerden@hitt.nl> wrote:

> My problem is to create a shared object on a UNIX system. When I use your
> compiler/linker to create a shared object and I want to link some additional
> libraries with it using the -L and -l options, I still get error messages
> for unresolved symbols, althoug I'm sure all necessary libraries are
> included.

This is a linker issue, not a compiler issue, so a question to the
binutils mailing list would probably have been more appropriate.

Anyway, this is kind of a linker FAQ.  The order of object files and
libraries *is* relevant, and the linker does a single pass looking for
undefined symbols.  So, if a static library is listed *before* object
files or other libraries that use symbols from it, they won't be
pulled into the executable or shared library that you're creating.  If
static libraries have cross-dependencies, you may have to list them
more than once.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me


More information about the Gcc-help mailing list