13#include "libmesh/libmesh_config.h"
16#ifdef LIBMESH_HAVE_DLOPEN
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)
Wrapper class to facilitate loading and lifetime management of dynamic libraries and obtaining pointe...
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.
void * _handle
Library handle returned by dlopen.
const std::string _library_file
Library file name.