[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

dlopen() under AIX with gcc/g++

From: Robert Boehne
Subject: dlopen() under AIX with gcc/g++
Date: Tue, 08 May 2001 15:34:13 -0500


I've been trying to understand dynamic library loading under
AIX, particularly when using gcc/g++ (2.95.2).  I've found that a C
program and library compiled with gcc will dynamicaly load
when compiled (and then linked) with:
gcc -g -c foo.c
gcc -shared -o libfoo.a foo.o
gcc -g -c bar.c
gcc -g -o bar bar.o

Note, no options (as in -Wl,-b*) are required.  This is
much better than xlc* which needs extra options passed to
the linker.
Now, if I make the one function that is resolved at
run-time "extern C" and change the source extention to .cpp,
g++ with the commands above cannot create the executable
so that it resolves the reference at runtime.
The only way I could get this to happen was to specify
libfoo.a on bar's link line.  That defeats the purpose
of using dlopen, of course.
  It seems that there are other options getting passed to
the AIX linker under the hood, and that gcc does the
right thing, but g++ doesn't quite manage.  Of course,
this is a much more difficult problem in C++ than C.

Does anyone know how to get g++ to do the right thing for dlopen?
I've been trying numerous different incantations of -Wl,-b 
options, but nothing seems to work.


Robert Boehne             Software Engineer
Ricardo Software   Chicago Technical Center
TEL: (630)789-0003 x. 238
FAX: (630)789-0127
email:  address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]