Update
CI / GCC 16 / C++26 / default (pull_request) Has been cancelled
CI / GCC 16 / C++26 / sanitizers (pull_request) Has been cancelled
CI / GCC 16 / C++26 / werror (pull_request) Has been cancelled

Signed-off-by: faumaray <faumaray@gmail.com>
This commit is contained in:
faumaray committed 2026-07-12 02:37:49 +03:00
1 parent 9a54f15e7e
commit f94366104e
7 files changed
+100 -13

No files matched your search

+2
View File
@@ -17,6 +17,7 @@ enum class LoadError {
CreateFailed,
NotSupported, // platform does not support dlopen
StateRejected, // new instance refused the serialized state
ActivationFailed, // on_load threw or readiness validation failed
UnknownPlugin, // PluginManager: no plugin registered under that name
};
@@ -72,6 +73,7 @@ private:
IPlugin* plugin_ {};
destroy_fn destroy_ {};
transfer_fn transfer_ {};
ready_fn ready_ {};
state_version_fn state_version_{};
serialize_fn serialize_ {};
free_string_fn free_string_ {};
+8
View File
@@ -55,6 +55,12 @@ public:
// JSON) after create and after each hot-reload swap, before
// on_load(). The string is only valid for the duration of the call.
//
// Optional (transactional activation check):
// int void_plugin_ready(void* instance)
// — called after on_load() and state restoration, immediately before
// the instance becomes visible. Return 0 when the plugin is ready.
// Any other value aborts load/reload and keeps the old instance.
//
// Optional v2 state protocol (preferred over transfer_state when both
// sides provide it; survives layout changes between plugin versions):
//
@@ -74,6 +80,7 @@ using destroy_fn = void (*)(void*);
using info_fn = PluginInfo (*)(void);
using transfer_fn = void (*)(void* old_instance, void* new_instance);
using configure_fn = void (*)(void* instance, const char* config);
using ready_fn = int (*)(void* instance);
using state_version_fn = std::uint32_t (*)(void);
using serialize_fn = const char* (*)(void* instance);
using free_string_fn = void (*)(const char*);
@@ -85,6 +92,7 @@ inline constexpr const char* kDestroySymbol = "void_plugin_destroy";
inline constexpr const char* kInfoSymbol = "void_plugin_info";
inline constexpr const char* kTransferSymbol = "void_plugin_transfer_state";
inline constexpr const char* kConfigureSymbol = "void_plugin_configure";
inline constexpr const char* kReadySymbol = "void_plugin_ready";
inline constexpr const char* kStateVersionSymbol = "void_plugin_state_version";
inline constexpr const char* kSerializeSymbol = "void_plugin_serialize_state";
inline constexpr const char* kFreeStringSymbol = "void_plugin_free_string";