Hi, Many thanks for your replies. The most common answer to my "question one" was - "create a global static instance of some class, its constructor will be run at link time and its destructor will be called at unlink time (and make sure the proper functions are being called in the constructor and destructor)". This is, unfortunately, the solution that I have been using, but I got sick of it. Each time I need to do some special actions while loading and/or unloading the library, I need to write a special additional "dummy" class, which does nothing except calling routines in the default constructor and destructor (I was wondering if there is something more elegant in CINT/ROOT foreseen for this purpose ...). Another interesting answer was - "add a static data member to the class, any static data member of the class is initiated at shared library loading time". The problem here is that there is no way to specify the function that should be called at "shared library UN-loading time". BTW. The linker usually provides a similar solution, often called an "entry point" - which can be a user's defined routine which does the initialization. But again there is no way to define a routine for the "exit". The only answer to my "question two" was "42". As you maybe remember, I have forgotten the question, but ... the answer makes it possible to "reverse-engineer" it. The question for that particular answer would be "How much is 6 times 9 ?" Unfortunately this is definitely NOT the question that I meant. Here it is (I promised to ask it once I remember it again ...). 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" - as in the answer to my question "one" above. Thanks in advance, Best regards, Jacek.
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:14 MET