public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* [Fwd: aix, dlopen(NULL, .), and gcc]
@ 2000-11-13 19:05 Scott Dudley
  2000-11-13 19:51 ` Alexandre Oliva
  2000-11-13 20:01 ` aix, dlopen(NULL, .), and gcc David Edelsohn
  0 siblings, 2 replies; 4+ messages in thread
From: Scott Dudley @ 2000-11-13 19:05 UTC (permalink / raw)
  To: gcc-help, gcc

--

Microsoft gives you Windows but Unix gives you the whole house!


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Fwd: aix, dlopen(NULL, .), and gcc]
  2000-11-13 19:05 [Fwd: aix, dlopen(NULL, .), and gcc] Scott Dudley
@ 2000-11-13 19:51 ` Alexandre Oliva
  2000-11-13 20:01 ` aix, dlopen(NULL, .), and gcc David Edelsohn
  1 sibling, 0 replies; 4+ messages in thread
From: Alexandre Oliva @ 2000-11-13 19:51 UTC (permalink / raw)
  To: Scott Dudley; +Cc: gcc-help, gcc

On Nov 14, 2000, Scott Dudley <scott@telesoft.com> wrote:

> i'm using gcc 2.95.2 on aix 4.3.3 attempting to use the NULL path
> argument to dlopen().  i've gotten this to work flawlessly on linux but
> have been unsuccessful in my efforts to compile/link on aix.

Some systems require certain options to be given to the linker to
allow a program or library to be dlopened.  I don't know whether
that's the case of AIX.  I suggest that you try to link your program
using GNU libtool, with the flag -export-dynamic, that will be
translated to whatever magic is required for a program or library to
be dlopen-able.

As a matter of fact, this has nothing to do with which compiler you're
using, so this question doesn't belong in a GCC forum.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: aix, dlopen(NULL, .), and gcc
  2000-11-13 19:05 [Fwd: aix, dlopen(NULL, .), and gcc] Scott Dudley
  2000-11-13 19:51 ` Alexandre Oliva
@ 2000-11-13 20:01 ` David Edelsohn
  2000-11-13 21:22   ` Scott Dudley
  1 sibling, 1 reply; 4+ messages in thread
From: David Edelsohn @ 2000-11-13 20:01 UTC (permalink / raw)
  To: Scott Dudley; +Cc: gcc-help, gcc

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: aix, dlopen(NULL, .), and gcc
  2000-11-13 20:01 ` aix, dlopen(NULL, .), and gcc David Edelsohn
@ 2000-11-13 21:22   ` Scott Dudley
  0 siblings, 0 replies; 4+ messages in thread
From: Scott Dudley @ 2000-11-13 21:22 UTC (permalink / raw)
  To: David Edelsohn; +Cc: gcc-help, gcc

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!



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-11-13 21:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-11-13 19:05 [Fwd: aix, dlopen(NULL, .), and gcc] Scott Dudley
2000-11-13 19:51 ` Alexandre Oliva
2000-11-13 20:01 ` aix, dlopen(NULL, .), and gcc David Edelsohn
2000-11-13 21:22   ` Scott Dudley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).