Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
dynamic_library.hpp
Go to the documentation of this file.
1#pragma once
2
3// RAII dynamic library loader — wraps dlopen/LoadLibrary
4
5#include <string>
6#include <string_view>
7
8namespace pulp::runtime {
9
11public:
12 DynamicLibrary() = default;
14
16 bool open(std::string_view path);
17
19 void close();
20
22 void* find_symbol(std::string_view name);
23
25 bool is_open() const { return handle_ != nullptr; }
26
28 const std::string& error() const { return error_; }
29
30 // No copy
33
34 // Move
37
38private:
39 void* handle_ = nullptr;
40 std::string error_;
41};
42
43} // namespace pulp::runtime
DynamicLibrary & operator=(const DynamicLibrary &)=delete
bool is_open() const
Whether a library is currently loaded.
Definition dynamic_library.hpp:25
void close()
Close the library.
DynamicLibrary(DynamicLibrary &&other) noexcept
bool open(std::string_view path)
Load a shared library by path. Returns false on failure.
DynamicLibrary & operator=(DynamicLibrary &&other) noexcept
void * find_symbol(std::string_view name)
Look up a symbol by name. Returns nullptr if not found.
const std::string & error() const
Last error message (platform-specific).
Definition dynamic_library.hpp:28
DynamicLibrary(const DynamicLibrary &)=delete
Definition generated_event_source.hpp:33
@ other
Definition udev_monitor.hpp:26