Originally posted by: ArtK
I'm having an issue with dlopen() loading libraries that I would like some advice on. It's a tad complicated, so please bear with me.
There is a whole chain of programs and libraries that are loaded and/or executed. I have no control over the upper part of this "stack," except for being able to set the LIBPATH environment variable and having it stick. We eventually get down to my first shared library, LibX. LibX issues a dlopen() to load LibY. The load of LibY is failing.
LibY is linked with a runtime module from another product, ProdRTA.a (a shared library is inside the archive, in typical AIX fashion.) ProdRTA.a exists in two forms, one is 32-bit and the other is 64-bit. The 32-bit library is in /usr/lib (i.e. /usr/lib/ProdRT.a). The 64-bit library is in /usr/ProdA/lib64/ProdRT.a. LibX and LibY (and all of their ancestors) are 64-bit libraries or programs.
Despite the fact that /usr/ProdA/lib64 is baked into the runtime path for LibX and LibY, and I have LIBPATH=/usr/ProdA/lib64, the runtime loader is attempting to load /usr/lib/ProdRT.a and the load is failing because we can't mix modes.
I see in the AIX documentation that the load() subroutine will favor the path at exec time, if the L_LIBPATH_EXEC flag is set. dlopen() has no such flags and the dlopen() documentation doesn't mention the possiblity.
Loading /usr/ProdA/lib64/ProdRTA.a before loading LibY doesn't help, the runtime loader still searches /usr/lib first.
I'm interested in any ideas about: 1) Why the loader is ignoring LIBPATH and the baked-in paths; and 2) How I can make this work!
Thanks!
#AIX-Forum