2017-11-01 20:14:23 +01:00
|
|
|
/******************************************************************************/
|
|
|
|
/* DYNAMIC LIBRARIES **********************************************************/
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _H_EBCL_DYNLIB
|
|
|
|
#define _H_EBCL_DYNLIB
|
|
|
|
|
2017-11-01 23:21:01 +01:00
|
|
|
#include <ebcl/Strings.hh>
|
|
|
|
#include <ebcl/Utilities.hh>
|
|
|
|
namespace ebcl {
|
2017-11-01 20:14:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*= DYNAMIC LIBRARY SUPPORT ==================================================*/
|
|
|
|
|
|
|
|
class T_DynLib : public A_PrivateImplementation
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
T_DynLib( ) = delete;
|
|
|
|
T_DynLib( T_DynLib const& ) = delete;
|
|
|
|
T_DynLib& operator =( T_DynLib const& ) = delete;
|
|
|
|
|
|
|
|
/* Initialise and set the name of the library to load */
|
|
|
|
explicit T_DynLib( T_String const& name );
|
|
|
|
explicit T_DynLib( char const* const name );
|
|
|
|
|
|
|
|
/* Load/unload the library */
|
|
|
|
bool load( );
|
|
|
|
void unload( );
|
|
|
|
|
|
|
|
/* Check whether the library has been loaded */
|
|
|
|
bool isLoaded( ) const noexcept;
|
|
|
|
/* Obtain the last error that was encoutered */
|
|
|
|
T_String lastError( ) const noexcept;
|
|
|
|
|
|
|
|
/* Symbol access. The library MUST be loaded. */
|
|
|
|
void* getRawSymbol( char const* name ) const noexcept;
|
|
|
|
template< typename T >
|
|
|
|
T* getPointer( char const* name ) const noexcept;
|
|
|
|
template< typename T >
|
|
|
|
std::function< T > getFunction(
|
|
|
|
char const* name ) const noexcept;
|
|
|
|
};
|
|
|
|
M_CLASS_POINTERS( DynLib );
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lw
|
|
|
|
#endif // _H_EBCL_DYNLIB
|
2017-11-01 23:21:01 +01:00
|
|
|
#include <ebcl/inline/DynLib.hh>
|