This is the mail archive of the 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: aix, dlopen(NULL, .), and 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:


or use -Wl,-bexpall which will work in this case but may cause problems in
more complicated settings.


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