Unix Technical Forum

Erratic behvaiour of dlopen AIX

This is a discussion on Erratic behvaiour of dlopen AIX within the AIX Operating System forums, part of the Unix Operating Systems category; --> Hi, I have an application which talks to the database using the ODBC APIs. In this I use the ...


Go Back   Unix Technical Forum > Unix Operating Systems > AIX Operating System

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-05-2008, 04:18 AM
Philips P
 
Posts: n/a
Default Erratic behvaiour of dlopen AIX

Hi,
I have an application which talks to the database using the ODBC APIs.
In this I use the dlopen function to open the ODBC driver
manager(libodbc.so) which generally is a .so file(on Solaris, Linux)
On AIX I donnot have a .so file but have a libodbc.a which internally
maps to another file called the odbc.so (which has all the symbols
which generally should be present under the libodbc.so)
In the app I try to open the libodbc.so using the dlopen which is
succesfully executed. All the calls to the dlsym function are also
successful. But None of the functions which are part of the ODBC
driver are working.
I have read on the net that there are some problems with the usage of
the shared objects on the AIX machine. My questions:
1) Since I donnot have a .so (libodbc.so) file is it right to pass
this as an argument to the dlopen function
2) How is it that the dlopen and the slsym function are not giving
errors and still I am not able to use the function present in the
library
3) Is there any work around to make this work
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-05-2008, 04:19 AM
Paul Pluzhnikov
 
Posts: n/a
Default Re: Erratic behvaiour of dlopen AIX

phil_pp1@yahoo.com (Philips P) writes:

> I have an application which talks to the database using the ODBC APIs.
> In this I use the dlopen function to open the ODBC driver
> manager(libodbc.so) which generally is a .so file(on Solaris, Linux)
> On AIX I donnot have a .so file but have a libodbc.a which internally
> maps to another file called the odbc.so


Huh? What do you mean "internally maps"?

I suspect libodbc.a simply *contains* odbc.so (you can verify this
with "ar tv libodbc.a"), in which case you should be calling

dlopen("libodbc.a(odbc.so)", RTLD_LAZY|RTLD_MEMBER);

> In the app I try to open the libodbc.so using the dlopen which is
> succesfully executed.


This will *not* open libodbc.a. If it returns success, then somewhere
on your system you have libodbc.so, which may not be the library
you want to dlopen().

> All the calls to the dlsym function are also
> successful. But None of the functions which are part of the ODBC
> driver are working.


Perhaps libodbc.so contains "do-nothing" stubs, and was intended
for something else?

> I have read on the net that there are some problems with the usage of
> the shared objects on the AIX machine.


There are no problems with "usage of shared objects" on AIX.
It's just that they work differently from every other UNIX.

> 1) Since I donnot have a .so (libodbc.so) file is it right to pass
> this as an argument to the dlopen function


No. See above.

> 2) How is it that the dlopen and the slsym function are not giving
> errors and still I am not able to use the function present in the
> library


See above.

> 3) Is there any work around to make this work


Yes: if you want to open libodbc.a, you must call dlopen() with
correct parameters.

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:20 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com