super basic rust cdylib plugin system
at master 334 B view raw
1pub trait Plugin { 2 fn load(&self); 3} 4 5pub fn say_hello(name: String) { 6 println!("Hello, {name}!"); 7} 8 9#[macro_export] 10macro_rules! plugin { 11 ($plugin:tt) => { 12 #[unsafe(no_mangle)] 13 pub unsafe extern "Rust" fn provide_plugin() -> Box<dyn plugin_api::Plugin> { 14 Box::new($plugin) 15 } 16 }; 17}