Jeff Trawick wrote on May 24: > [EMAIL PROTECTED] (Don Anderson) writes: > > > Hello, > > > > I seek your advice on some weirdness I've noticed with AIX 4.3.3. I > > want to create a shared library for dynamic loading using libtool with > > the -module option. When the AIX linker (or something in the compiler > > chain) creates the shared library, it is put into a .a file. That is, > > it creates libfoo.a, a static archive of one element, which is > > libfoo.so.0, and that shared object has an SONAME of libfoo.so. > > Apparently, the linker knows how to link and run against that animal > > if you just wanted to link. But if you want to dynamically load it > > (say from java or Tcl), these programs cannot dlopen the .a. So I > > need to do a post-install step like this: > > > > $ ar xv libfoo.a > > x - libfoo.so.0 > > $ ln -s libfoo.so.0 libfoo.so > > > > This gives me a libfoo.so that I can dlopen directly. > > A couple of hints: > > 1) If you want to load a member of an archive on AIX, add the > RTLD_MEMBER flag to your normal dlopen() flags. You can then > specify "libfoo.a(libfoo.so.0)" as the object to load.
This would be just the trick, but sadly I can't take advantage of it. We're building a JNI library that must be loaded by an arbitrary Java runtime. That stuff has already been compiled, so we can't mess with the dlopen() flags. > 2) As I understand it, libtool doesn't create the non-archive style of > shared library on AIX unless it thinks you are using run-time > linking (-Wl,-brtl). You may or may not want run-time linking. Now this is interesting. I tried to get it to work for me, without success. This concept looks broken to me (in libtool 1.4.2 and 1.4d, also in the CVS tree). libtool.m4 contains some stuff in the AIX portion that is dependent on whether LDFLAGS contains -Wl,-brtl or -brtl. But it's written so that it evaluates LDFLAGS at config time, not when the resulting libtool is run. If you don't believe me, try creating a libtool on an AIX system. Then set "LDFLAGS=-brtl" in your environment and configure it again. Hmmm, that libtool script looks mighty different. With the first libtool you made, you'll always get the those .a container libraries made. With the second libtool, you'll never get them, and you'll get the -G option. Is that really what we want? Well it's not what I want, I'm actually building several libraries, some to be linked against and some to be dynamically loaded. Also it seems like this checking of -brtl/-Wl,-brtl flags is not the libtool approach (even if it were done when libtool runs). We should use the -module flag to indicate that someone is building a library that needs runtime linking and loading. I think that's the intent of the -brtl checks, right? - Don -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Don Anderson [EMAIL PROTECTED] Sleepycat Software Inc. +1-978-287-4781 118 Tower Rd. http://www.sleepycat.com Lincoln, MA 01773 _______________________________________________ Libtool mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/libtool