SLUG Mailing List Archives
[SLUG] Finding .so's path from inside the .so at runtime?
- To: slug@xxxxxxxxxxx
- Subject: [SLUG] Finding .so's path from inside the .so at runtime?
- From: amos@xxxxxxxxxxxxxxxxxx
- Date: Fri, 25 Feb 2005 11:17:48 +1100
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; b=OINYsWRBPSulDvZ7kp0bn2RMpebC6kcTt76fumUYqq09ErU89Ivhjft4Ex6bWyONrb3NjQzp1EaUtytzHTvkVg542ssOfG+w0V1UWFj3dJhmJN2V5RGMFiHt8+kM5kvpH56P71L+6HZ6n3SznbMJZwHwVVntkZ50zj97iUaHF/A=
Is there a standard way for a .so file to find where it was loaded from?
I ported an ISAPI module from windows to Linux (to connect to Zeus
web server). The original code on Windows relays on the .DLL's ability
to find its path on the disk in order to lookup a configuration file relative
On Linux I just used an anvironment variable but later I noticed that
the Java Plugin for Mozilla relays on being symbolically-linked
(rather than copied) in order to run, and I suspect that maybe it
needs this in order to find the rest of the files at runtime (e.g. the
runtime class library, the zoneinfo files etc).
I'd like to use the same trick myself.
Currently I think of immitating the ld.so algorithm for finding files
but that could get unreliable if the algorithm changes one day,
and involves duplicating of the work already done by the loader itself.
I'd rather try to get the real info from the dynamic loader.
(BTW - the ISAPI module is Caucho's Resin and is under GPL, the port
is expected to be included in the next release of Resin (3.0.12), and I'll be
happy to provide the patch to anyone who asks).