This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Exporting symbols for dlopen from shared library?
- To: maratb at cs dot berkeley dot edu (Marat Boshernitsan)
- Subject: Re: Exporting symbols for dlopen from shared library?
- From: hjl at lucon dot org (H.J. Lu)
- Date: Wed, 29 Apr 1998 18:35:59 -0700 (PDT)
- Cc: egcs at cygnus dot com
>
>
> Hi,
>
> I am having the following problem with explicit loading of dynamic
> libraries:
>
> I am working on dynamic library that can be loaded into the JVM and
> Tcl/Tk interpreter. This library, say foo.so, needs to load another
> dynamic library using dlopen, say bar.so. The name of bar.so is not
> determinable until runtime. The problem is that bar.so relies on
> certain symbols from foo.so that it cannot find when loaded with dlopen.
>
> I was having exactly the same problem before, when foo.so was built as
> an executable, but I managed to fix it by passing -export-dynamic to the
> linker (-rdynamic to gcc on Linux). Is there a similar compiler/linker
> magic I can use to build foo.so?
>
> Compiler egcs-1.0.2.
> Linker GNU ld 2.9
> Platforms Redhat Linux 5.0, Solaris 2.6.
>
Have you tried RTLD_GLOBAL?
# man dlopen
will tell what RTLD_GLOBAL does.
--
H.J. Lu (hjl@gnu.org)