This class is a wrapper that loads functions from dll/sa (dynamic library). More...
#include <DcDynamicLibrary.h>
Public Member Functions | |
CdcDynamicLibrary (const CdcString &name) | |
Constructor - Loads the library. | |
~CdcDynamicLibrary () | |
Destructor - Frees the library. | |
void * | GetFunctionByName (const CdcString &func_name) |
Returns a pointer to a function in the library. | |
bool | IsLoaded () |
Returns True if the library is loaded. | |
CdcString | GetLastError () |
Return the last error message, or an empty string. | |
CdcString | GetLibraryName () |
Return the dynamic library name. |
This class is a wrapper that loads functions from dll/sa (dynamic library).
It loads the library in the Constructor, and frees it in the Destructor.
Definition at line 34 of file DcDynamicLibrary.h.
CdcDynamicLibrary::CdcDynamicLibrary | ( | const CdcString & | name ) |
Constructor - Loads the library.
DcDynamicLibrary.cpp: implementation of the CdcDynamicLibrary class.
name | The library name (and path). |
for documentation see the header file.
Definition at line 28 of file DcDynamicLibrary.cpp.
CdcDynamicLibrary::~CdcDynamicLibrary | ( | ) |
Destructor - Frees the library.
Definition at line 37 of file DcDynamicLibrary.cpp.
void * CdcDynamicLibrary::GetFunctionByName | ( | const CdcString & | func_name ) |
Returns a pointer to a function in the library.
It access the function by it's name. The caller must cast this pointer to the function pointer! If the function cannot be found in the library, or if the library cannot be loaded, GetFunctionByName will return NULL. The error message can be retrieved from GetLastError
func_name | The name of the function in the library. |
Definition at line 43 of file DcDynamicLibrary.cpp.
CdcString CdcDynamicLibrary::GetLastError | ( | ) | [inline] |
Return the last error message, or an empty string.
Definition at line 76 of file DcDynamicLibrary.h.
CdcString CdcDynamicLibrary::GetLibraryName | ( | ) | [inline] |
Return the dynamic library name.
Definition at line 82 of file DcDynamicLibrary.h.
bool CdcDynamicLibrary::IsLoaded | ( | ) | [inline] |
Returns True if the library is loaded.
Definition at line 70 of file DcDynamicLibrary.h.