CppUnit project page | FAQ |
Manages dynamic libraries. More...
#include <DynamicLibraryManager.h>
Public Types | |
typedef void * | Symbol |
typedef void * | LibraryHandle |
Public Member Functions | |
DynamicLibraryManager (const std::string &libraryFileName) | |
Loads the specified library. | |
~DynamicLibraryManager () | |
Releases the loaded library.. | |
Symbol | findSymbol (const std::string &symbol) |
Returns a pointer on the specified symbol exported by the library. |
Private Member Functions | |
void | loadLibrary (const std::string &libraryName) |
void | releaseLibrary () |
LibraryHandle | doLoadLibrary (const std::string &libraryName) |
void | doReleaseLibrary () |
Symbol | doFindSymbol (const std::string &symbol) |
std::string | getLastErrorDetail () const |
DynamicLibraryManager (const DynamicLibraryManager ©) | |
Prevents the use of the copy constructor. | |
void | operator= (const DynamicLibraryManager ©) |
Prevents the use of the copy operator. |
Private Attributes | |
LibraryHandle | m_libraryHandle |
std::string | m_libraryName |
Manages dynamic libraries.
The Dynamic Library Manager provides a platform independent way to work with dynamic library. It load a specific dynamic library, and can returns specific symbol exported by the dynamic library.
If an error occurs, a DynamicLibraryManagerException is thrown.
typedef void* DynamicLibraryManager::LibraryHandle |
typedef void* DynamicLibraryManager::Symbol |
CPPUNIT_NS_BEGIN DynamicLibraryManager::DynamicLibraryManager | ( | const std::string & | libraryFileName | ) |
Loads the specified library.
libraryFileName | Name of the library to load. |
DynamicLibraryManagerException | if a failure occurs while loading the library (fail to found or load the library). |
DynamicLibraryManager::~DynamicLibraryManager | ( | ) |
Releases the loaded library..
|
private |
Prevents the use of the copy constructor.
|
private |
Returns a pointer on the specified symbol exported by the library.
May throw any exceptions (indicates failure).
symbol | Name of the symbol exported by the library. |
NULL
indicates failure.
|
private |
Loads the specified library.
May throw any exceptions (indicates failure).
libraryName | Name of the library to load. |
NULL
indicates failure.
|
private |
Releases the loaded library.
The handle of the library to free is in m_libraryHandle
. It is never NULL
.
DynamicLibraryManager::Symbol DynamicLibraryManager::findSymbol | ( | const std::string & | symbol | ) |
Returns a pointer on the specified symbol exported by the library.
symbol | Name of the symbol exported by the library. |
NULL
. DynamicLibraryManagerException | if the symbol is not found. |
|
private |
Returns detailed information about doLoadLibrary() failure.
Called just after a failed call to doLoadLibrary() to get extra error information.
|
private |
Loads the specified library.
libraryName | Name of the library to load. |
DynamicLibraryManagerException | if a failure occurs while loading the library (fail to found or load the library). |
|
private |
Prevents the use of the copy operator.
|
private |
Releases the loaded library.
|
private |
|
private |
Send comments to: CppUnit Developers |