Go to the documentation of this file.
64 void load(std::filesystem::path libPath);
105 template <
class SymbolType>
106 SymbolType
getSymbol(
const std::string& functionName);
119 std::filesystem::path libPath;
120 std::string lastError;
121 bool unloadOnDestruct =
true;
132 template <
class SymbolType>
142 void* resultRaw = dlsym(handle, functionName.c_str());
148 const char* error = dlerror();
158 #pragma GCC diagnostic push
159 #pragma GCC diagnostic ignored "-Wpedantic"
160 SymbolType result = (SymbolType)(resultRaw);
161 #pragma GCC diagnostic pop
165 lastError =
"Could not cast into desired function type";
void reload()
Reloads the current library.
std::shared_ptr< DynamicLibrary > DynamicLibraryPtr
void load(std::filesystem::path libPath)
Loads a shared library from the specified path.
static std::string GetSharedLibraryFileExtension()
This exception is thrown if an invalid value was specified for a property.
void setFlags(int newFlags)
Sets the shared library opening flags and reloads the library, if a library is already loaded.
void setUnloadOnDestruct(bool unload)
std::filesystem::path getLibraryFilename() noexcept
bool isLibraryLoaded() noexcept
Checks if a library is currently loaded.
std::string getErrorMessage() noexcept
Base Class for all Logging classes.
~DynamicLibrary() override
void unload()
Unloads library.
The DynamicLibrary class provides a mechanism to load libraries at runtime.
SymbolType getSymbol(const std::string &functionName)
Retrieves a symbol (mostly a function) from the loaded library.
This file offers overloads of toIce() and fromIce() functions for STL container types.