Determining the path to a Library

Trevor Saunders trev.saunders at gmail.com
Mon Jan 10 14:38:38 UTC 2011


On Mon, Jan 10, 2011 at 06:42:25AM -0600, John J. Boyer wrote:
> Is there a reliable way for a library to determine the path from which 
> it wa loaded. I want to use this as a base for referencing the data 
> files that the library uses. Will this work on Mac OSX also?

the only thing that comes to mind is looking around in /proc/self for
something useful.  I believe the standard solution to this problem is
that you  use a #define for the path of the data in the source, and then
use the build system to arrange for that define to be defined as
whatever the path should actually be.  So what whould generally happen
is that autotools stuff would arrange for DATA_PATH to be defined as
what ever the make variable DATADIR is.  This should be fairly portable,
but I don't have an OSX box so....

Trev

> 
> Thanks,
> John
> 
> -- 
> John J. Boyer; President, Chief Software Developer
> Abilitiessoft, Inc.
> http://www.abilitiessoft.com
> Madison, Wisconsin USA
> Developing software for people with disabilities
> 
> _______________________________________________
> Blinux-list mailing list
> Blinux-list at redhat.com
> https://www.redhat.com/mailman/listinfo/blinux-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/blinux-list/attachments/20110110/febc4fd3/attachment.sig>


More information about the Blinux-list mailing list