55 explicit FFI(
const std::filesystem::path &pluginFolder,
VM *vm);
67 bool addPlugin(
const std::filesystem::path &pluginPath);
81 bool loadPlugin(
const std::filesystem::path &library,
VM *vm);
88 std::vector<std::string>
scanPlugins(
const std::filesystem::path &folder);
void unloadAll()
Unloads all currently loaded plugins and clears internal state.
std::vector< Plugin > plugins_
Loaded plugins.
std::filesystem::path pluginFolder_
Plugin search folder.
~FFI()
Destructor. Unloads all loaded plugins.
std::vector< std::string > scanPlugins(const std::filesystem::path &folder)
Scans a folder for plugin libraries.
Value native_add_plugin(const std::vector< Value > &args, VM *vm)
Native function to load a plugin at runtime.
bool loadPlugin(const std::filesystem::path &library, VM *vm)
Loads a single plugin from a library file.
bool addPlugin(const std::filesystem::path &pluginPath)
Adds a single plugin from the specified path.
VM * vm_
Pointer to the Phasor VM.
FFI(const std::filesystem::path &pluginFolder, VM *vm)
Constructs the FFI manager and loads plugins.
A value in the Phasor VM.
void(* FFIFunction)(const PhasorAPI *api, PhasorVM *vm)
The Phasor Programming Language and Runtime.
Represents a loaded plugin.
void * handle
POSIX handle for the loaded library.
std::function< void()> shutdown
Optional shutdown callback.
std::string path
Path to the plugin file.
FFIFunction init
Plugin initialization function.