This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: aix, dlopen(NULL, .), and gcc
- To: Scott Dudley <scott at telesoft dot com>
- Subject: Re: aix, dlopen(NULL, .), and gcc
- From: David Edelsohn <dje at watson dot ibm dot com>
- Date: Mon, 13 Nov 2000 23:00:29 -0500
- cc: gcc-help at gcc dot gnu dot org, gcc at gcc dot gnu dot org
>>>>> Scott Dudley writes:
Scott> i'm using gcc 2.95.2 on aix 4.3.3 attempting to use the NULL path
Scott> argument to dlopen(). i've gotten this to work flawlessly on linux but
Scott> have been unsuccessful in my efforts to compile/link on aix. below are
Scott> listed two source files, main.c and foo.c. i want to compile both into
Scott> a.out and be able to use dlopen() and dlsym() to obtain a handle or
Scott> pointer to foo(). following is excerpt from dlopen() manpage:
Scott> If the value of FilePath is NULL, a value for the main application is
Scott> returned. This allows dynamically loaded objects to look up symbols in
Scott> the main executable, or for an application to examine symbols available
Scott> within itself.
Scott> can anyone tell me how to compile foo.c and ultimately, link both main
Scott> and foo into a single executable?
For dlopen() [and the underlying AIX load()] functions to work,
the symbols must be visible. You either need to explicitly export the
symbols you will inquire with GCC -Wl,-bE:symbols.exp where symbols.exp
contains a single line:
foo
or use -Wl,-bexpall which will work in this case but may cause problems in
more complicated settings.
David