class Poco::SharedLibrary
Overview
The SharedLibrary class dynamically loads shared libraries at run-time. More…
#include <SharedLibrary.h> class SharedLibrary: private Poco::SharedLibraryImpl { public: // enums enum Flags; // construction SharedLibrary(); SharedLibrary(const std::string& path); SharedLibrary( const std::string& path, int flags ); // methods void load(const std::string& path); void load( const std::string& path, int flags ); void unload(); bool isLoaded() const; bool hasSymbol(const std::string& name); void* getSymbol(const std::string& name); const std::string& getPath() const; static std::string suffix(); };
Inherited Members
protected: // enums enum Flags; // methods void loadImpl( const std::string& path, int flags ); void unloadImpl(); bool isLoadedImpl() const; void* findSymbolImpl(const std::string& name); const std::string& getPathImpl() const; static std::string suffixImpl();
Detailed Documentation
The SharedLibrary class dynamically loads shared libraries at run-time.
Construction
SharedLibrary()
Creates a SharedLibrary object.
SharedLibrary(const std::string& path)
Creates a SharedLibrary object and loads a library from the given path.
SharedLibrary( const std::string& path, int flags )
Creates a SharedLibrary object and loads a library from the given path, using the given flags.
See the Flags enumeration for valid values.
Methods
void load(const std::string& path)
Loads a shared library from the given path.
Throws a LibraryAlreadyLoadedException if a library has already been loaded. Throws a LibraryLoadException if the library cannot be loaded.
void load( const std::string& path, int flags )
Loads a shared library from the given path, using the given flags.
See the Flags enumeration for valid values. Throws a LibraryAlreadyLoadedException if a library has already been loaded. Throws a LibraryLoadException if the library cannot be loaded.
void unload()
Unloads a shared library.
bool isLoaded() const
Returns true iff a library has been loaded.
bool hasSymbol(const std::string& name)
Returns true iff the loaded library contains a symbol with the given name.
void* getSymbol(const std::string& name)
Returns the address of the symbol with the given name.
For functions, this is the entry point of the function. Throws a NotFoundException if the symbol does not exist.
const std::string& getPath() const
Returns the path of the library, as specified in a call to load() or the constructor.
static std::string suffix()
Returns the platform-specific filename suffix for shared libraries (including the period).
In debug mode, the suffix also includes a “d” to specify the debug version of a library (e.g., “d.so”, “d.dll”) unless the library has been compiled with -DPOCO_NO_SHARED_LIBRARY_DEBUG_SUFFIX.