Go to the documentation of this file.
33 flags = RTLD_NOW | RTLD_GLOBAL;
39 if (!unloadOnDestruct)
50 ARMARX_ERROR <<
"Error while unloading dynamic library: " << lastError;
62 if (libPath.is_relative() && !std::filesystem::exists(libPath))
64 std::string absolutePath;
68 libPath = absolutePath;
72 if (!std::filesystem::exists(libPath))
78 handle = dlopen(libPath.c_str(), flags);
85 const char* error = dlerror();
99 this->libPath = libPath;
111 bool result = dlclose(handle) == 0;
115 const char* error = dlerror();
139 return handle !=
nullptr;
144 this->unloadOnDestruct =
unload;
void reload()
Reloads the current library.
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
~DynamicLibrary() override
void unload()
Unloads library.
static bool getAbsolutePath(const std::string &relativeFilename, std::string &storeAbsoluteFilename, const std::vector< std::string > &additionalSearchPaths={}, bool verbose=true)
This file offers overloads of toIce() and fromIce() functions for STL container types.