[Top][All Lists]

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

Re: AIX library creation for dynamic loading

From: Don Anderson
Subject: Re: AIX library creation for dynamic loading
Date: Tue, 28 May 2002 11:03:33 -0400 (EDT)

Jeff Trawick wrote on May 24:
 > address@hidden (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
 > >, and that shared object has an SONAME of
 > > 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 -
 > >    $ ln -s
 > > 
 > > This gives me a 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(" 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                    address@hidden
        Sleepycat Software Inc.         +1-978-287-4781
        118 Tower Rd.         
        Lincoln, MA 01773

reply via email to

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