Manages loading, registering, and unloading native FFI plugins.
More...
#include <ffi.hpp>
|
| | FFI (const std::filesystem::path &pluginFolder, VM *vm) |
| | Constructs the FFI manager and loads plugins.
|
| | ~FFI () |
| | Destructor. Unloads all loaded plugins.
|
| bool | addPlugin (const std::filesystem::path &pluginPath) |
| | Adds a single plugin from the specified path.
|
| 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.
|
| std::vector< std::string > | scanPlugins (const std::filesystem::path &folder) |
| | Scans a folder for plugin libraries.
|
| void | unloadAll () |
| | Unloads all currently loaded plugins and clears internal state.
|
Manages loading, registering, and unloading native FFI plugins.
This class scans a folder for plugins, loads them, registers their functions with the VM, and handles cleanup when destroyed.
Definition at line 47 of file ffi.hpp.
◆ FFI()
| Phasor::FFI::FFI |
( |
const std::filesystem::path & | pluginFolder, |
|
|
VM * | vm ) |
|
explicit |
Constructs the FFI manager and loads plugins.
- Parameters
-
| pluginFolder | Path to the folder containing plugins. |
| vm | Pointer to the Phasor VM instance to register plugin functions with. |
Definition at line 290 of file ffi.cpp.
◆ ~FFI()
Destructor. Unloads all loaded plugins.
Definition at line 307 of file ffi.cpp.
◆ addPlugin()
| bool Phasor::FFI::addPlugin |
( |
const std::filesystem::path & | pluginPath | ) |
|
Adds a single plugin from the specified path.
- Parameters
-
| pluginPath | Path to the plugin file. |
- Returns
- True if the plugin was added successfully, false otherwise.
Definition at line 211 of file ffi.cpp.
◆ loadPlugin()
| bool Phasor::FFI::loadPlugin |
( |
const std::filesystem::path & | library, |
|
|
VM * | vm ) |
|
private |
Loads a single plugin from a library file.
Loads a plugin, finds its entry point, and initializes it.
- Parameters
-
| library | Path to the shared library file. |
| vm | Pointer to the VM to register plugin functions with. |
- Returns
- True if the plugin loaded successfully, false otherwise.
Definition at line 167 of file ffi.cpp.
◆ native_add_plugin()
| Value Phasor::FFI::native_add_plugin |
( |
const std::vector< Value > & | args, |
|
|
VM * | vm ) |
Native function to load a plugin at runtime.
Definition at line 312 of file ffi.cpp.
◆ scanPlugins()
| std::vector< std::string > Phasor::FFI::scanPlugins |
( |
const std::filesystem::path & | folder | ) |
|
|
private |
Scans a folder for plugin libraries.
Scans configured plugin directories for shared libraries.
- Parameters
-
| folder | Path to the folder to scan. |
- Returns
- A vector of plugin file paths.
Definition at line 219 of file ffi.cpp.
◆ unloadAll()
| void Phasor::FFI::unloadAll |
( |
| ) |
|
|
private |
Unloads all currently loaded plugins and clears internal state.
Unloads all currently loaded plugins.
Definition at line 277 of file ffi.cpp.
◆ pluginFolder_
| std::filesystem::path Phasor::FFI::pluginFolder_ |
|
private |
◆ plugins_
| std::vector<Plugin> Phasor::FFI::plugins_ |
|
private |
Loaded plugins.
Definition at line 95 of file ffi.hpp.
◆ vm_
The documentation for this class was generated from the following files: