This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Shared library load address (FAQ??)
- To: bharadwaj dot yadavalli at compaq dot com
- Subject: Re: Shared library load address (FAQ??)
- From: Wolfram Gloger <wmglo at dent dot med dot uni-muenchen dot de>
- Date: 16 Apr 2001 16:11:39 -0000
- CC: libc-alpha at sources dot redhat dot com
- References: <200104161600.MAA09964@ives.lkg.dec.com>
> Is there a way to find out the address at which a shared library is
> loaded (via dlopen)?
Here is a loop to walk the table of loaded libraries:
(I hope it's still correct for the latest glibc)
#include <link.h>
#include <execinfo.h>
struct link_map* l_ptr;
for(l_ptr = _r_debug.r_map; l_ptr; l_ptr = l_ptr->l_next) {
/* l_ptr->l_name is the name of the DSO */
/* l_ptr->l_addr is the address where the DSO is loaded */
}
Regards,
Wolfram.