[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AIX library creation for dynamic loading
From: |
Jeff Trawick |
Subject: |
Re: AIX library creation for dynamic loading |
Date: |
24 May 2002 08:12:32 -0400 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 |
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
> 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.
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.
--
Jeff Trawick | address@hidden
Born in Roswell... married an alien...