13 #include "libmesh/libmesh_config.h" 16 #ifdef LIBMESH_HAVE_DLOPEN 35 T
getFunction(std::string func,
bool hard_fail =
true);
49 #ifdef LIBMESH_HAVE_DLOPEN 54 void * pointer = dlsym(
_handle, func.c_str());
57 const char * dlsym_error = dlerror();
58 if (dlsym_error && hard_fail)
61 mooseError(
"DynamicLibraryLoader error: Unable to find symbol '",
66 std::string(dlsym_error));
69 return *
reinterpret_cast<T *
>(&pointer);
void mooseError(Args &&... args)
void * _handle
Library handle returned by dlopen.
T getFunction(std::string func, bool hard_fail=true)
Get a function/data pointer of type T to a function exported from the loaded library.
const std::string _library_file
Library file name.
Wrapper class to facilitate loading and lifetime management of dynamic libraries and obtaining pointe...
DynamicLibraryLoader(const std::string &library_file)