[ROOT] finding of a configuration file (second call for help)

From: Jacek M. Holeczek (holeczek@us.edu.pl)
Date: Wed Jan 30 2002 - 09:16:46 MET


Assume you have a shared library somewhere ... you load it ... now assume
you need to "read" a configuration file which should be placed in the same
subdirectory that the library comes from. Is there any easy way to learn
from which subdirectory the shared library has been loaded ?
Now, typically, you don't even know the name of the library - the only
assumption is that - this is the same library that provides the function
which tries to "read" the configuration file - so, first the function
should find from which shared library it comes, then from which
subdirectory it has been loaded, then find the configuration file there.
Now, if it makes anything simpler - assume that this will be done while
loading the library - just in the constructor of a "global static instance
of some class". If it makes things easier - assume the OS is Linux.
One should not rely on any "environment variables", nor that one will 
define the "directory" during compilation.
(Everything happens in ROOT, of course.)
Thanks in advance,
Best regards,
Jacek.
P.S. Well, I was told that "Microsoft does provide a function: the
     GetModuleFileName function retrieves the full path and file name for
     the file containing the specified module", but it doesn't seem to me
     to be a sufficient reason to get in love with Windoze. Jacek.



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:40 MET