gary_core/plugins/
mod.rs

1pub mod runtime;
2
3#[macro_export]
4macro_rules! declare_plugin {
5    ($plugin_type:ty, $constructor:path) => {
6        #[no_mangle]
7        pub extern "C" fn _plugin_create() -> *mut $crate::plugins::runtime::RuntimePlugin {
8            // make sure the constructor is the correct type.
9            let constructor: fn() -> $plugin_type = $constructor;
10
11            let object = constructor();
12            let boxed: Box<$crate::plugins::runtime::RuntimePlugin> = Box::new(object);
13            Box::into_raw(boxed)
14        }
15    };
16}