This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: dlinfo for the calling shared library
* Zack Weinberg:
> Do we have a supported way to make dlinfo() queries for the shared
> library from which the call originates, without the library having to
> know its own soname? (If it knows its own soname, it can call dlopen
> on itself, but I'm looking into a scenario where that information is
> not available.)
dladdr1 with RTLD_DL_LINKMAP returns the link map, which has a public
l_name member in <link.h>. If you do not want to use the handle/link
map equivalence, you could dlopen l_name, and that should give you back
the same handle in an official way.
Thanks,
Florian