Are all the libraries that you are linking with present on the target
system?
"Exec format error" in dlopen() usually comes if the library that is
being opened has some unresolved symbols.
To find out which unresolved symbols are there, try linking the
library (temporarily) without -G option, only -qmkshrobj option, and
that will give you all the unresolved symbols.
Hope this helps,
Gaurav
jvs@stockley.com (Jonathan Stockley) wrote in message news:<87010bd6.0406141745.28d74756@posting.google. com>...
> I have a wrapper C++ API around Oracle's OCCI 9 to give some DB
> independance.
> This library is loaded into the running program using dlopen(). The
> problem I'm seeing is that it works fine on the machine I build on but
> on another machine the dlopen fails and dlerror() returns "Exec format
> error" and nothing further.
>
> Both machines are running AIX 5.1 but only one has Visual Age C++ 6
> installed. The test program below works just fine on the machine with
> Visual Age C++ 6 installed but fails on the other, which has the C++
> runtime for VA C++ 6 installed.
>
> Here is the link command I am using:
>
> xlC_r -G -qmkshrobj -o libdb_oracle.so db_oracle.o -L/openssl/static \
> -L/product/9.2.0/lib32 -L/product/9.2.0/rdbms/lib32 -brtl \
> -bnolibpath -bnoipath -lssl -lcrypto -locci9 -lclntst9 -ldl -lc \
> -lpthreads -lodm -lm -lbsd_r -lld
>
> The ssl, crypto, occi9 and clntst9 are all static libraries.
>
> The dump -Hv output is as follows:
>
> $ dump -Hv libfgldb_oracle.so
>
> libdb_oracle.so:
>
> ***Loader Section***
> Loader Header Information
> VERSION# #SYMtableENT #RELOCent LENidSTR
> 0x00000001 0x000001b2 0x000066d8 0x000000b8
>
> #IMPfilID OFFidSTR LENstrTBL OFFstrTBL
> 0x0000000c 0x0004faf0 0x000018a1 0x0004fba8
>
>
> ***Import File Strings***
> INDEX PATH BASE MEMBER
> 0 /usr/lib:/lib
> 1 libodm.a shr.o
> 2 libdl.a shr.o
> 3 libc.a shr.o
> 4 libc.a aio.o
> 5 libpthreads.a shr_xpg5.o
> 6 libC.a shr.o
> 7 libC.a shr2.o
> 8 libC.a shr3.o
> 9 libC.a ansi_32.o
> 10 librtl.a shr.o
> 11 ..
>
>
> I have a very simple program that just calls dlopen() on the library
> and prints the dlerror() if the dlopen() fails, here it is:
>
> #include <iostream>
> #include <dlfcn.h>
>
> int main(int argc, char* argv[])
> {
> std::cout << "Loading " << argv[1] << " ..." << std::endl;
> void* handle = dlopen(argv[1], RTLD_NOW|RTLD_MEMBER);
> if (handle == 0)
> {
> std::cout << "Unable to load library" << std::endl
> << dlerror() << std::endl;
>
> return 1;
> }
>
> std::cout << "Load successful...." << std::endl;
> dlclose(handle);
> }
>
> I'd appreciate any insight and suggestions as to how to proceed.
>
> Thanks,
> Jo