29 #ifndef PT_SYSTEM_LIBRARY_H
30 #define PT_SYSTEM_LIBRARY_H
32 #include <Pt/System/Api.h>
33 #include <Pt/System/SystemError.h>
34 #include <Pt/System/Path.h>
153 {
return this->resolve(symbol); }
162 operator const void*()
const;
196 class LibraryImpl* _impl;
216 : _lib(lib), _sym(
sym)
231 operator void*()
const
243 #endif // PT_SYSTEM_LIBRARY_H
Core module.
Definition: Allocator.h:33
static const char * prefix()
Returns the prefix for shared libraries.
Library()
Default Constructor which does not load a library.
Shared library loader.
Definition: Library.h:107
Symbol resolved from a shared library.
Definition: Library.h:205
SymbolNotFound(const std::string &sym)
Construct with symbol.
static const char * suffix()
Returns the extension for shared libraries.
void close()
Closes the shared library.
Library(const Path &path)
Loads a shared library.
Exception class indication a system error.
Definition: SystemError.h:43
const std::string & symbol() const
Returns the symbol, which was not found.
Definition: Library.h:61
const Path & path() const
Returns the path to the shared library image.
Symbol getSymbol(const char *symbol) const
Resolves the symbol symbol from the shared library.
Library & operator=(const Library &other)
Assignment operator.
SymbolNotFound(const char *sym)
Construct with symbol.
const Library & library() const
Returns the library where the symbol was resolved.
Definition: Library.h:226
Thrown, when a symbol is not found in a library.
Definition: Library.h:46
bool operator!() const
Returns true if invalid.
Library(const Library &other)
Copy constructor.
void * operator[](const char *symbol) const
Resolves the symbol symbol from the shared library Returns the address of the symbol or 0 if it was n...
Definition: Library.h:152
~SymbolNotFound()
Destructor.
Definition: Library.h:57
Represents a path in the file-system.
Definition: Path.h:48
Symbol(const Library &lib, void *sym)
Construct with library and symbol address.
Definition: Library.h:215
~Library()
The destructor unloads the shared library from memory.
Library & open(const Path &path)
Loads a shared library.
void * sym() const
Returns the symbol address.
Definition: Library.h:221
void * resolve(const char *symbol) const
Resolves the symbol symbol from the shared library Returns the address of the symbol or 0 if it was n...
Symbol()
Default constructor.
Definition: Library.h:209