Shared library load address (FAQ??)

Wolfram Gloger wmglo@dent.med.uni-muenchen.de
Mon Apr 16 09:13:00 GMT 2001


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



More information about the Libc-alpha mailing list