ps
Class DllLoader
in DllLoader.h
in DllLoader.cpp
- class DllLoader
Method Summary |
bool |
IsLoaded() const
Check whether the library has been loaded successfully. |
bool |
LoadDLL()
Attempt to load and initialise the library, if not already. |
void |
LoadSymbol( const char* name, T& fptr ) const
Attempt to load a named symbol from the library. |
private void |
LoadSymbolInternal( const char* name, void** fptr ) const
|
void |
Unload()
Unload the library, if it has been loaded already. |
m_Handle
private void* m_Handle;
m_Name
private const char* m_Name;
DllLoader
public DllLoader( const char* name );
- Prepare the DLL loader. Does no actual work.
- Parameters:
name
- base name of the library (from which we'll derive
"name.dll", "libname_dbg.so", etc). Pointer must remain valid for
this object's lifetime (which is fine if you just use a string literal).
~DllLoader
public ~DllLoader();
IsLoaded
public bool IsLoaded() const;
- Check whether the library has been loaded successfully. Returns false
before
LoadDLL
has been called; otherwise returns the same as
LoadDLL did.
LoadDLL
public bool LoadDLL();
- Attempt to load and initialise the library, if not already. Can be harmlessly
called multiple times. Returns false if unsuccessful.
LoadSymbol
public void LoadSymbol( const char* name, T& fptr ) const;
- Attempt to load a named symbol from the library. If
IsLoaded
is
false, throws PSERROR_DllLoader_DllNotLoaded. If it cannot load the
symbol, throws PSERROR_DllLoader_SymbolNotFound. In both cases, sets fptr
to NULL. Otherwise, fptr is set to point to the loaded function.
- Throws:
PSERROR_DllLoader
LoadSymbolInternal
private void LoadSymbolInternal( const char* name, void** fptr ) const;
Unload
public void Unload();
- Unload the library, if it has been loaded already. (Usually not needed,
since the destructor will unload it.)