This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Exporting symbols for dlopen from shared library?


> 
> 
> 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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]