MIRA
Public Types | Public Member Functions | Static Public Member Functions | List of all members
SharedLibrary Class Reference

Class for loading a single shared library. More...

#include <utils/SharedLibrary.h>

Inheritance diagram for SharedLibrary:
Inheritance graph
[legend]

Public Types

typedef HMODULE Handle
 
typedef FARPROC Symbol
 

Public Member Functions

 SharedLibrary (const Path &library)
 Loads the specified library. More...
 
 ~SharedLibrary ()
 
bool isOpen () const
 Return true if the shared library is currently open. More...
 
void close ()
 Close the shared library. More...
 
Symbol getSymbol (const std::string &symbol)
 Get a symbol from the library. More...
 

Static Public Member Functions

static const char * getLibPrefix ()
 Return the name prefix of libraries (e.g. More...
 
static const char * getLibPostfix ()
 Returns the name postfix of libraries (e.g. More...
 
static const char * getLibExtension ()
 Return library extension (e.g. More...
 
static SharedLibrary::Handle loadSharedLibrary (const char *library)
 low level opening of libraries without using the class wrapper More...
 
static SharedLibrary::Symbol getSymbol (SharedLibrary::Handle handle, const char *function)
 low level getting symbols from libraries without using the class wrapper More...
 
static void closeSharedLibrary (SharedLibrary::Handle handle)
 low level closing of libraries without using the class wrapper More...
 

Detailed Description

Class for loading a single shared library.

The library is loaded/opened on construction and closed on destruction.

Member Typedef Documentation

◆ Handle

typedef HMODULE Handle

◆ Symbol

typedef FARPROC Symbol

Constructor & Destructor Documentation

◆ SharedLibrary()

SharedLibrary ( const Path library)

Loads the specified library.

Afterwards its symbols can be accessed using the getSymbol() method.

Parameters
[in]libraryThe relative or absolute path of the shared library.
Exceptions
XIOIf the library can not be found or loaded.

◆ ~SharedLibrary()

Member Function Documentation

◆ getLibPrefix()

static const char* getLibPrefix ( )
static

Return the name prefix of libraries (e.g.

'lib' for unix shared libraries). The full library name is: <prefix>NAME<postfix><extension>

◆ getLibPostfix()

static const char* getLibPostfix ( )
static

Returns the name postfix of libraries (e.g.

'_d' for windows debug libraries) The full library name is: <prefix>NAME<postfix><extension>

◆ getLibExtension()

static const char* getLibExtension ( )
static

Return library extension (e.g.

".dll" for windows libraries) The full library name is: <prefix>NAME<postfix><extension>

◆ isOpen()

bool isOpen ( ) const
inline

Return true if the shared library is currently open.

Returns
true if open

◆ close()

void close ( )
inline

Close the shared library.

◆ getSymbol() [1/2]

Symbol getSymbol ( const std::string &  symbol)
inline

Get a symbol from the library.

Exceptions
XIOwhen obtaining the symbol failed.
Parameters
[in]symbolThe name of the symbol
Returns
Handle to the symbol

◆ loadSharedLibrary()

static SharedLibrary::Handle loadSharedLibrary ( const char *  library)
static

low level opening of libraries without using the class wrapper

◆ getSymbol() [2/2]

static SharedLibrary::Symbol getSymbol ( SharedLibrary::Handle  handle,
const char *  function 
)
static

low level getting symbols from libraries without using the class wrapper

◆ closeSharedLibrary()

static void closeSharedLibrary ( SharedLibrary::Handle  handle)
static

low level closing of libraries without using the class wrapper


The documentation for this class was generated from the following file: