Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

equivalent for dladdr() functionality on AIX

280 views
Skip to first unread message

Vani

unread,
Oct 10, 2002, 7:39:46 AM10/10/02
to
Can anyone give me the exact equivalent of dladdr() function on AIX platform.
Message has been deleted

Gary R. Hook

unread,
Oct 14, 2002, 10:09:07 AM10/14/02
to
Nicholas Dronen wrote:

> Vani <van...@rsys.com> wrote:
>
>>Can anyone give me the exact equivalent of dladdr() function on AIX platform.
>
>
> If loadquery(L_GETINFO, . . . ) doesn't work for you (I've not used it
> myself), the obvious and horrifying workaround it to use nm to generate
> the source of loadable shared object that contains a struct or variable
> listing the base address in the object file of some symbol or other. Then,
> at run time, you get the "on-disk" address of the symbol and use dladdr
> to get the "in-memory" address, subtract the former from the latter,
> and, viola, you get at least the load address of the shared library.
> It's a kludge, but I've used it (for a project that had to be portable)
> and it works.

*shudder* Not fun for mere mortals.

In other words, there isn't an _exact_equivalent_. AIX doesn't supply
that function, nor anything like it.

--
Gary R. Hook / AIX PartnerWorld for Developers / These opinions are MINE
________________________________________________________________________

Anurag S

unread,
Oct 24, 2002, 3:41:15 AM10/24/02
to
Nicholas Dronen <ndr...@io.frii.com> wrote in message news:<3da599e0$0$8229$7586...@news.frii.net>...

> Vani <van...@rsys.com> wrote:
> > Can anyone give me the exact equivalent of dladdr() function on AIX platform.
>
> If loadquery(L_GETINFO, . . . ) doesn't work for you (I've not used it
> myself), the obvious and horrifying workaround it to use nm to generate
> the source of loadable shared object that contains a struct or variable
> listing the base address in the object file of some symbol or other. Then,
> at run time, you get the "on-disk" address of the symbol and use dladdr
> to get the "in-memory" address, subtract the former from the latter,
> and, viola, you get at least the load address of the shared library.
> It's a kludge, but I've used it (for a project that had to be portable)
> and it works.
>
> Regards,
>
> Nicholas

Nicholas,

You said "use dladdr to get in-memory-address", but we don't have
dladdr and we want equivalent of dladdr on RS/6000. Am I missing
something in you answer ?

Nicholas Dronen

unread,
Oct 24, 2002, 4:04:42 AM10/24/02
to
Anurag S <anurag.s...@rsystems.com> wrote:
> Nicholas Dronen <ndr...@io.frii.com> wrote in message news:<3da599e0$0$8229$7586...@news.frii.net>...
>> Vani <van...@rsys.com> wrote:
>> > Can anyone give me the exact equivalent of dladdr() function on AIX platform.
>> If loadquery(L_GETINFO, . . . ) doesn't work for you (I've not used it
>> myself), the obvious and horrifying workaround it to use nm to generate
>> the source of loadable shared object that contains a struct or variable
>> listing the base address in the object file of some symbol or other. Then,
>> at run time, you get the "on-disk" address of the symbol and use dladdr
>> to get the "in-memory" address, subtract the former from the latter,
>> and, viola, you get at least the load address of the shared library.
>> It's a kludge, but I've used it (for a project that had to be portable)
>> and it works.

> Nicholas,

> You said "use dladdr to get in-memory-address", but we don't have
> dladdr and we want equivalent of dladdr on RS/6000. Am I missing
> something in you answer ?

My mistake. I meant to say "dlsym()".

Regards,

Nicholas

0 new messages