This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Shared library load address (FAQ??)


> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]