nidas
v1.2-1520
|
Class providing dynamic loader functionality of system functions dlopen() and dlsym() to look up symbols. More...
#include <DynamicLoader.h>
Public Member Functions | |
void * | lookup (const std::string &name) throw (nidas::util::Exception) |
Search the main program itself, and its currently loaded libraries for a symbol. More... | |
void * | lookup (const std::string &library, const std::string &name) throw (nidas::util::Exception) |
Return a pointer to a symbol from the given library. More... | |
Static Public Member Functions | |
static DynamicLoader * | getInstance () throw (nidas::util::Exception) |
Get a pointer to the singleton instance of DynamicLoader. More... | |
Private Member Functions | |
DynamicLoader () throw (nidas::util::Exception) | |
DynamicLoader (const DynamicLoader &) | |
No copy. More... | |
DynamicLoader & | operator= (const DynamicLoader &) |
No assignment. More... | |
~DynamicLoader () | |
Private Attributes | |
void * | _defhandle |
Handle, returned by dlopen(), of the program itself, and its linked and dynamically loaded libraries. More... | |
std::map< std::string, void * > | _libhandles |
Handles, by library name, returned by dlopen() of libraries that are currently open, because one or more symbols have been found in them. More... | |
Static Private Attributes | |
static DynamicLoader * | _instance = 0 |
static nidas::util::Mutex | _instanceLock |
Class providing dynamic loader functionality of system functions dlopen() and dlsym() to look up symbols.
|
private |
References _defhandle.
Referenced by getInstance().
|
private |
No copy.
|
private |
|
static |
Get a pointer to the singleton instance of DynamicLoader.
References _instance, _instanceLock, and DynamicLoader().
Referenced by nidas::core::DOMObjectFactory::createObject().
void * DynamicLoader::lookup | ( | const std::string & | name | ) | |
throw | ( | nidas::util::Exception | |||
) |
Search the main program itself, and its currently loaded libraries for a symbol.
Throws an exception if the lookup fails.
Referenced by nidas::core::DOMObjectFactory::createObject().
void* nidas::core::DynamicLoader::lookup | ( | const std::string & | library, |
const std::string & | name | ||
) | |||
throw | ( | nidas::util::Exception | |
) |
Return a pointer to a symbol from the given library.
@ param library: name of the library. @ param name: name of the symbol to look up.
If the library name is an empty string, then the libraries linked with the program, and any currently loaded dynamic libraries will be searched. If the library name is absolute (begins with a forward slash), then it is loaded. Otherwise a search for the library is done, using the program's library directory search path, which is controlled by compile time flags, the LD_LIBRARY_PATH environment variable, and ld.so/ldconfig/ld.so.conf. lookup() throws an exception if the library could not be found and loaded or the symbol could not be found in the library. If the symbol is found, the library will remain loaded, and symbols in that library can then be found via lookup(name), or by specifying an emptry string for the library.
|
private |
No assignment.
|
private |
Handle, returned by dlopen(), of the program itself, and its linked and dynamically loaded libraries.
Referenced by DynamicLoader().
|
staticprivate |
Referenced by getInstance().
|
staticprivate |
Referenced by getInstance().
|
private |
Handles, by library name, returned by dlopen() of libraries that are currently open, because one or more symbols have been found in them.