Better structure

This commit is contained in:
2025-08-29 13:52:04 +02:00
parent 68bf864a52
commit 6149cb7744
5 changed files with 50 additions and 23 deletions
+15
View File
@@ -0,0 +1,15 @@
#[macro_export]
macro_rules! export_plugin {
($plugin_type:ty) => {
static PLUGIN: std::sync::Mutex<Option<$plugin_type>> = std::sync::Mutex::new(None);
#[unsafe(no_mangle)]
pub extern "C" fn init() {
let mut plugin = PLUGIN.lock().unwrap();
*plugin = Some(<$plugin_type>::default());
if let Some(plugin) = plugin.as_mut() {
plugin.init();
}
}
};
}