CppUnit project page | FAQ | CppUnit home page |
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). \param symbol Name of the symbol exported by the library. \return Pointer on the symbol. \c NULL indicates failure.
|
private |
Loads the specified library.
May throw any exceptions (indicates failure). \param libraryName Name of the library to load. \return Handle of the loaded library. \c NULL indicates failure.
|
private |
Releases the loaded library.
The handle of the library to free is in \c m_libraryHandle. It is never \c NULL. \warning Must NOT throw any exceptions (called from destructor).
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. \return Detailed information about the failure of the call to doLoadLibrary() that just failed.
|
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.
\warning Must NOT throw any exceptions (called from destructor).
|
private |
|
private |
|
hosts this site. |
Send comments to: CppUnit Developers |