This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: aix, dlopen(NULL, .), and gcc
- To: David Edelsohn <dje at watson dot ibm dot com>
- Subject: Re: aix, dlopen(NULL, .), and gcc
- From: Scott Dudley <scott at telesoft dot com>
- Date: Mon, 13 Nov 2000 22:19:07 -0700
- CC: gcc-help at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Organization: Telesoft Corp.
- References: <200011140400.XAA28414@mal-ach.watson.ibm.com>
David Edelsohn wrote:
> >>>>> 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:
that was it! many thanks david.
>
>
> foo
>
> or use -Wl,-bexpall which will work in this case but may cause problems in
> more complicated settings.
>
> David
--
Microsoft gives you Windows but Unix gives you the whole house!