This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Finding the path of the current binary?
- From: Roland McGrath <roland at redhat dot com>
- To: Mike Hearn <mike at theoretic dot com>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Fri, 7 Mar 2003 14:24:31 -0800
- Subject: Re: Finding the path of the current binary?
> Doesn't that require the library knows its own soname?
That's not really an unreasonable requirement. It would just be one
argument to a general function. But as has been pointed out, it's not
really required because a function can be written that examines the
_DYNAMIC table itself. If that function lives in another shared library,
it needs to take &_DYNAMIC as an argument from code in the library that
wants to know about itself.
> > That said, it might indeed be nice to have a library interface for
> > substituting $ORIGIN and similar magic bits.
>
> That would be idea really. Any idea how complex such a patch would be?
Adding something to glibc would be trivial if an interface is chosen.
The Solaris `dlinfo' interface looks reasonable at a glance. I could add that.