This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: dlopen/RPATH/RUNPATH
- From: Roland McGrath <roland at redhat dot com>
- To: wkf at sinavigator dot com
- Cc: libc-alpha at sources dot redhat dot com, kukuk at suse dot de
- Date: Sun, 8 Jan 2006 12:42:56 -0800 (PST)
- Subject: Re: dlopen/RPATH/RUNPATH
> 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.)