AIX and dlopen
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > AIX and dlopen




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    AIX and dlopen  
gailw


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-17-04 10:37 PM

AIX archives it's shared libraries into .a files.  E.g. libmqm_r.a contains
libmqm_r.o where libmqm_r.o is a shared library (well, I think it's a shared
library).  I extracted it and "file" tells me
libmqm_r.o   "executable (RISC System/6000) or object module not stripped".

If I want to a dlopen of one of these shared libraries, do I have to first
extract the shared library from the archive file.  I tried dlopen of both
libmqm_r.a and libmqm_r.o and neither works.

Why did IBM do it so weird?

Thanks,

Jim









[ Post a follow-up to this message ]



    Re: AIX and dlopen  
David Schwartz


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-17-04 10:37 PM


"gailw" <gailw@worldnet.att.net> wrote in message
news:4E36c.26946$Pa7.690366@bgtnsc05-news.ops.worldnet.att.net...


> AIX archives it's shared libraries into .a files.  E.g. libmqm_r.a
> contains
> libmqm_r.o where libmqm_r.o is a shared library (well, I think it's a
> shared
> library).  I extracted it and "file" tells me
> libmqm_r.o   "executable (RISC System/6000) or object module not
> stripped".


I don't think those are shared libraries. They look like static
libraries.


> If I want to a dlopen of one of these shared libraries, do I have to first
> extract the shared library from the archive file.  I tried dlopen of both
> libmqm_r.a and libmqm_r.o and neither works.


You probably have to link them into a shared library with something like
'ld -shared'.

DS








[ Post a follow-up to this message ]



    Re: AIX and dlopen  
joe@invalid.address


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-18-04 02:37 AM

"gailw" <gailw@worldnet.att.net> writes:

> AIX archives it's shared libraries into .a files.  E.g. libmqm_r.a
> contains libmqm_r.o where libmqm_r.o is a shared library (well, I
> think it's a shared library).  I extracted it and "file" tells me
> libmqm_r.o "executable (RISC System/6000) or object module not
> stripped".
>
> If I want to a dlopen of one of these shared libraries, do I have to
> first extract the shared library from the archive file.  I tried
> dlopen of both libmqm_r.a and libmqm_r.o and neither works.

There isn't a special extension for shared libraries in AIX. They use
an extended form of COFF which doesn't need it (and therefore isn't
really "Common" anymore :-).

There used to be a very good reference on the web about this but I
can't find it now, and I don't remember all the details
precisely. However, if you build a shared library according to the man
page you should be able to dlopen() it in recent versions of
AIX. There's some distinction I can't recall at the moment about .o
files that are built to be dynamically loaded (and I can't find the
link any more) but maybe someone else here can help.

Try looking around on IBM's redbook web site. It's probably there
somplace.

> Why did IBM do it so weird?

Many times we think things are weird because we didn't design them :-)

Joe
--
Don't worry, be happy
- Bobby McFerrin





[ Post a follow-up to this message ]



    Re: AIX and dlopen  
joe@invalid.address


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-18-04 02:37 AM

joe@invalid.address writes:

> "gailw" <gailw@worldnet.att.net> writes:
> 
>
> There isn't a special extension for shared libraries in AIX. They use
> an extended form of COFF which doesn't need it (and therefore isn't
> really "Common" anymore :-).
>
> There used to be a very good reference on the web about this but I
> can't find it now, and I don't remember all the details
> precisely. However, if you build a shared library according to the man
> page you should be able to dlopen() it in recent versions of
> AIX. There's some distinction I can't recall at the moment about .o
> files that are built to be dynamically loaded (and I can't find the
> link any more) but maybe someone else here can help.

I found an internal (ie, local to my disk) reference which says that
you need to build a .o version of a library for dynamic loading, so
that's probably the distinction. It's been a coupld years since I've
done any programming on AIX though and I'm a little fuzzy on the
details so I don't want to be very specific.

The best advice I have is to read the ld man page. Maybe search the
web looking for an AIX library reference, although it looks to me like
they've purged them all (all my bookmarks are dead now).

Joe
--
Don't worry, be happy
- Bobby McFerrin





[ Post a follow-up to this message ]



    Re: AIX and dlopen  
gailw


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-18-04 02:37 AM

Actually, I extracted the libmqm_r.o file from the libmqm_r.a archive and I
was able to load it with dlopen and find a symbol with dlsym; so I think
it's a loadable shared library.

--

Gail

"David Schwartz" <davids@webmaster.com> wrote in message
news:c3ajiu$864$1@nntp.webmaster.com...
>
> "gailw" <gailw@worldnet.att.net> wrote in message
> news:4E36c.26946$Pa7.690366@bgtnsc05-news.ops.worldnet.att.net...
>
> 
>
>
>     I don't think those are shared libraries. They look like static
> libraries.
>
> 
first 
both 
>
>
>     You probably have to link them into a shared library with something
like
> 'ld -shared'.
>
>     DS
>
>
>







[ Post a follow-up to this message ]



    Re: AIX and dlopen  
Chuck Dillon


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-18-04 02:46 PM

gailw wrote:
> AIX archives it's shared libraries into .a files.  E.g. libmqm_r.a contain
s
> libmqm_r.o where libmqm_r.o is a shared library (well, I think it's a shar
ed
> library).  I extracted it and "file" tells me
> libmqm_r.o   "executable (RISC System/6000) or object module not stripped"
.
>
> If I want to a dlopen of one of these shared libraries, do I have to first
> extract the shared library from the archive file.  I tried dlopen of both
> libmqm_r.a and libmqm_r.o and neither works.
>
> Why did IBM do it so weird?
>
> Thanks,
>
> Jim
>
>
>
>

Some more stale memory based advice on AIX shared libraries.  As I
recall by default the symbols are not exported like on other *nix
systems.  The best resource I found was a white paper I found on a
developer's site, something linke bolder.ibm.com or some such.

Did you ask in comp.unix.aix?

-- ced

--
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.






[ Post a follow-up to this message ]



    Re: AIX and dlopen  
Bjorn Reese


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-18-04 08:35 PM

On Wed, 17 Mar 2004 14:30:54 -0800, David Schwartz wrote:

>     I don't think those are shared libraries. They look like static
> libraries.

An oddity about AIX is that shared libraries use the .a extension
(all code is position independent in the first place.)

--
mail1dotstofanetdotdk






[ Post a follow-up to this message ]



    Re: AIX and dlopen  
gailw


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-19-04 04:36 PM

Here is a post from comp.unix.aix.
I had already found the info about dlopen from a search of IBM site, but
this post provides a good reference - probably the one someone else
mentioned in this thread.
"gailw" <gailw@worldnet.att.net> writes:

> If I want to a dlopen of one of these shared libraries, do I have to first
> extract the shared library from the archive file.

No.

> I tried dlopen of both libmqm_r.a and libmqm_r.o and neither works.

Because neither is correct. You need:

dlopen("libmqm_r.a(libmqm_r.o)", RTLD_MEMBER);

> Why did IBM do it so weird?

Their shared libraries do not follow Solaris/SVR4 model.

The "weirdness" of the dlopen() only scratches the surface, there
are many more to come. If you are going to do any serious development
on AIX with shared libraries, begin by reading and understanding
this:

http://www-106.ibm.com/developerwor...pdfs/aix_ll.pdf

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 11:28 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register