Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
plugin_library.h
1// SPDX-FileCopyrightText: © 2026 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include <memory>
7#include <string_view>
8
9#include "utils/utf8_string.h"
10
11namespace zrythm::plugins
12{
13
24class PluginLibrary
25{
26public:
28 using FunctionSymbol = void (*) ();
29 PluginLibrary ();
30 ~PluginLibrary ();
31
32 PluginLibrary (const PluginLibrary &) = delete;
33 PluginLibrary &operator= (const PluginLibrary &) = delete;
34 PluginLibrary (PluginLibrary &&other) noexcept;
35 PluginLibrary &operator= (PluginLibrary &&other) noexcept;
36
43 [[nodiscard]] bool load (const utils::Utf8String &path);
44
48 FunctionSymbol resolve (std::string_view symbol_name);
49
53 void unload ();
54
58 [[nodiscard]] bool is_loaded () const;
59
63 [[nodiscard]] utils::Utf8String error_string () const;
64
65private:
66 struct Impl;
67 std::unique_ptr<Impl> impl_;
68};
69
70} // namespace zrythm::plugins
void unload()
Unloads the library.
void(*)() FunctionSymbol
Function pointer type returned when resolving library symbols.
utils::Utf8String error_string() const
Returns a human-readable description of the last error.
bool load(const utils::Utf8String &path)
Loads the plugin library at the given path.
FunctionSymbol resolve(std::string_view symbol_name)
Resolves a symbol from the loaded library.
bool is_loaded() const
Returns true if the library is currently loaded.
Lightweight UTF-8 string wrapper with safe conversions.
Definition utf8_string.h:37