12#ifndef MCRL2_UTILITIES_DYNAMIC_LIBRARY_H
13#define MCRL2_UTILITIES_DYNAMIC_LIBRARY_H
18#ifdef MCRL2_PLATFORM_WINDOWS
26 return LoadLibrary(fname.c_str());
32 return GetProcAddress(handle, procname.c_str());
38 return FreeLibrary(handle);
46 DWORD
last = GetLastError();
47 DWORD x = FormatMessage(
48 FORMAT_MESSAGE_ALLOCATE_BUFFER |
49 FORMAT_MESSAGE_FROM_SYSTEM,
53 reinterpret_cast<LPSTR
>(&buffer),
63 result =
"Unknown error.";
77 return dlopen(fname.c_str(), RTLD_NOW);
83 return dlsym(handle, procname.c_str());
89 return (dlclose(handle) == 0);
95 return std::string(dlerror());
142 catch(std::runtime_error&
error)
library_proc proc_address(const std::string &name)
virtual ~dynamic_library()
dynamic_library(const std::string &filename=std::string())
std::string get_last_error()
library_proc get_proc_address(library_handle handle, const std::string &procname)
bool close_module_handle(library_handle handle)
library_handle get_module_handle(const std::string &fname)
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
const function_symbol & last()
Constructor for function symbol @last.