ATLAS Offline Software
|
Shared library services. More...
#include <SealSharedLib.h>
Classes | |
struct | LibraryInfo |
Information about a currently loaded shared library. More... | |
Public Types | |
typedef void * | Data |
typedef void(* | Function) (void) |
typedef Callback1< const LibraryInfo & > | InfoHandler |
Public Member Functions | |
void | release (void) |
Release a shared library. More... | |
void | abandon (void) |
Abandon a library. More... | |
Data | data (const std::string &name, bool mangle=true) const |
Locate and return a reference to a data symbol called name. More... | |
Function | function (const std::string &name, bool mangle=true) const |
Locate and return a reference to a function symbol called name. More... | |
Static Public Member Functions | |
static std::string | path (void) |
static void path | ATLAS_NOT_THREAD_SAFE (const std::string &path) |
static std::string | libname (const std::string &name) |
Return a shared library name that follows the system conventions for naming shared library. More... | |
static std::string | symname (const std::string &name) |
Transform 'extern "C"' symbol name into a name suitable for lookup in a shared library, e.g. More... | |
static SharedLibrary * | self (void) |
Return a shared library object representing the application itself. More... | |
static SharedLibrary * | load (const std::string &name) |
Load a shared library and return an object representing it. More... | |
static void | loaded (InfoHandler &handler) |
Iterate and provide information about all currently loaded shared libraries. More... | |
Protected Member Functions | |
SharedLibrary (void *handle) | |
Protected constructor for initialising a library object. More... | |
~SharedLibrary (void) | |
Protected destructor for cleaning up a library object. More... | |
Private Member Functions | |
SharedLibrary (const SharedLibrary &) | |
SharedLibrary & | operator= (const SharedLibrary &) |
Private Attributes | |
void * | m_handle |
typedef void* Athena::SharedLibrary::Data |
Definition at line 160 of file SealSharedLib.h.
typedef void(* Athena::SharedLibrary::Function) (void) |
Definition at line 161 of file SealSharedLib.h.
Definition at line 175 of file SealSharedLib.h.
|
protected |
|
protected |
Protected destructor for cleaning up a library object.
The real destruction happens in release() or #abadon().
Definition at line 607 of file SealSharedLib.cxx.
|
private |
void Athena::SharedLibrary::abandon | ( | void | ) |
Abandon a library.
This simply destroys the shared library object (this
) without releasing the underlying dynamic object.
Definition at line 639 of file SealSharedLib.cxx.
SharedLibrary::Data Athena::SharedLibrary::data | ( | const std::string & | name, |
bool | mangle = true |
||
) | const |
Locate and return a reference to a data symbol called name.
If no such symbol exists, returns a null pointer. If mangle is the default true
, the symbol is mangled to the platform convention, typically prepending an underscore if required. The mangling does not refer to C++ name mangling, but to the mangling required to convert C identifiers to run-time symbol names; see symname() for details.
Definition at line 654 of file SealSharedLib.cxx.
SharedLibrary::Function Athena::SharedLibrary::function | ( | const std::string & | name, |
bool | mangle = true |
||
) | const |
Locate and return a reference to a function symbol called name.
If no such symbol exists, returns a null pointer. If mangle is the default true
, the symbol is mangled to the platform convention, typically prepending an underscore if required. The mangling does not refer to C++ name mangling, but to the mangling required to convert C identifiers to run-time symbol names; see symname() for details.
Definition at line 692 of file SealSharedLib.cxx.
|
static |
Return a shared library name that follows the system conventions for naming shared library.
name is the basic name of the shared library, without the name prefix ("lib" on unix) or the extension (".so", ".sl", ".dylib" or ".dll"). name must not have any directory components.
Definition at line 192 of file SealSharedLib.cxx.
|
static |
Load a shared library and return an object representing it.
The returned object is allocated with new
. The caller must release the object with either release() or abandon(). The method throws a #SharedLibraryError if the operation is not supported or some failure occurs. Please note that on several systems failure to properly load a library, e.g. due to missing symbols, is effectively fatal.
Definition at line 255 of file SealSharedLib.cxx.
|
static |
Iterate and provide information about all currently loaded shared libraries.
Definition at line 290 of file SealSharedLib.cxx.
|
private |
|
static |
void Athena::SharedLibrary::release | ( | void | ) |
Release a shared library.
This unloads any library the object currently refers to, then deletes this
. Note that releasing the library does not guarantee that it will actually be unloaded. If there are outstanding references to the library, explicit or implicit, the library will remain in memory.
Definition at line 616 of file SealSharedLib.cxx.
|
static |
Return a shared library object representing the application itself.
The returned object is allocated with new
. The caller must release the object with either release() or abandon(). The method throws a #SharedLibraryError if the operation is not supported or some failure occurs.
Definition at line 220 of file SealSharedLib.cxx.
|
static |
Transform 'extern "C"' symbol name into a name suitable for lookup in a shared library, e.g.
with data() or function(). Normally the latter two automatically perform the necessary mangling by calling this function, but the clients can also do the mangling themselves. The name should be in the form it is spelled in C source code.
Definition at line 210 of file SealSharedLib.cxx.
|
private |
Definition at line 197 of file SealSharedLib.h.