20 reinterpret_cast<char *
>(&
err), 0,
NULL) != 0) {
21 return std::shared_ptr<char>{
err, [](
char *e) {
LocalFree(e); }};
23 static char msg[] =
"(failed to get error message)";
24 return std::shared_ptr<char>{
msg, [](
char *) {}};
33 throw dynamic_load_error(
"Unable to load \"" +
so_filename.string() +
36 return std::shared_ptr<void>{h, +[](
void *) {}};
38 return std::shared_ptr<void>{
43void *
load_func(
void *handle,
const std::string &name) {
47 throw dynamic_load_error(
"Unable to load function '" + name +
49 return reinterpret_cast<void *
>(h);
60 return std::shared_ptr<void>{h, +[](
void *) {}};
62 return std::shared_ptr<void>{h, &
::dlclose};
66void *
load_func(
void *handle,
const std::string &name) {
69 auto *h =
::dlsym(handle, name.c_str());
void * load_func(void *lib_handle, const std::string &name)
Get a pointer to a function inside of a loaded DLL or SO file.
std::shared_ptr< void > load_lib(const std::filesystem::path &so_filename, DynamicLoadFlags flags)
Load a DLL or SO file.
Flags to be passed to dlopen.
Failed to load a DLL or SO file, or failed to access a function in it.