I am working on AIX 4.3, using g++ 3.0.4,
I have created a shared library which actually wraps the DB2 APIs.
The shared library is being loaded explicitly through dlopen() in main
The main program is able to call and execute the Administrative APIs
But for monitor APIs are giving Segmentation Fault.

The wrapper contains following code,
DYNLIB_EXPORT_API void sqlmonszWrap (unsigned long version,
_SQLOLDCHAR* reserved,
sqlma* sqlma_ptr,
unsigned long* buff_size,
struct sqlca* pSqlca) {
rc = sqlmonsz(version, reserved, sqlma_ptr, buff_size, pSqlca);

From main process I am calling as
sqlmonszWrap(SQLM_DBMON_VERSION5_2, 0, &ma_obj, &bufferSize, &sqlComnArea);

Immediately after this call the core dump occurs with segmentations fault.

options I am using while building are
-ldb2 -lm -ls -lnsl -lpthread -lstdc++

I tried with small program with directly calling DB2 API sqlmonsz()
function, it works fine.

What can be wrong in the

I tried debugging this with gdb
gdb output says
Program received signal SIGSEGV, Segmentation fault.
0xd08b41c0 in sqlowque () from /sqllib/lib/libdb2.a(shr.o)
what is this function (sqlowque() ) doing.