dlopen/RPATH/RUNPATH
Roland McGrath
roland@redhat.com
Sun Jan 8 20:43:00 GMT 2006
> This doesn't seem right to me. If I go to the trouble of setting
> up an -rpath, why wouldn't you want dlopen() to respect it?
That is not what it's for. You are talking about a global setting, and the
purpose of -rpath is for satisfying the dependencies of the thing you are
linking with -rpath. If any DT_RUNPATH setting were to have this global
effect, it would pollute the search paths of the whole executable with the
private settings for one DSO to find its own dependencies.
> Regardless, if dlopen() is considered correct as is, how could
> I query the -rpath at runtime from within the application so that
> I can emulate the behavior I desire?
I think what you really want to do is simply not rely on the search path
for your dlopen. Pass dlopen a name like "$ORIGIN/../lib/libmine.so.1".
(Names containing /s are not subject to the search path.)
More information about the Libc-alpha
mailing list