guanaqo main
Utilities for scientific software
Loading...
Searching...
No Matches
dl.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file
4/// @ingroup dylib
5/// Dynamic library loading and symbol lookup.
6
8#include <guanaqo/export.h>
9#include <filesystem>
10#include <memory>
11#include <stdexcept>
12
13namespace guanaqo {
14
15/// Failed to load a DLL or SO file, or failed to access a function in it.
16/// @ingroup dylib
17struct GUANAQO_EXPORT dynamic_load_error : std::runtime_error {
18 using std::runtime_error::runtime_error;
19};
20
21/// Load a DLL or DSO file.
22/// @ingroup dylib
23GUANAQO_EXPORT std::shared_ptr<void>
24load_lib(const std::filesystem::path &so_filename, DynamicLoadFlags flags);
25/// Get a pointer to a function inside of a loaded DLL or SO file.
26/// @ingroup dylib
27GUANAQO_EXPORT void *load_func(void *lib_handle, const std::string &name);
28
29} // namespace guanaqo
Flags wrapper for dynamic library loading.
void * load_func(void *lib_handle, const std::string &name)
Get a pointer to a function inside of a loaded DLL or SO file.
Definition dl.cpp:58
std::shared_ptr< void > load_lib(const std::filesystem::path &so_filename, DynamicLoadFlags flags)
Load a DLL or DSO file.
Definition dl.cpp:48
Flags to be passed to dlopen.
Definition dl-flags.hpp:13
Failed to load a DLL or SO file, or failed to access a function in it.
Definition dl.hpp:17