Go to the first, previous, next, last section, table of contents.


Exporting dynamic symbols

In order for a symbol to be dynamically resolved (typically using the dlsym(3) function), it must be specially declared in the object module where it is defined.

Libtool provides the `-export-dynamic' link flag (see section Link mode), which does this declaration. You need to use this flag if you are linking a shared library that will be dlopened.

For example, if we wanted to build a shared library, `libhello', that would later be dlopened by an application, we would add `-export-dynamic' to the other link flags:

burger$ libtool gcc -export-dynamic -o libhello.la foo.lo \
                hello.lo -rpath /usr/local/lib -lm
burger$

Another situation where you would use `-export-dynamic' is if symbols from your executable are needed to satisfy unresolved references in a library you want to dlopen. In this case, you should use `-export-dynamic' while linking the executable that calls dlopen:

burger$ libtool gcc -export-dynamic -o hell-dlopener main.o
burger$


Go to the first, previous, next, last section, table of contents.