#[macro_export]
macro_rules! export_vst3 {
($config:expr, $component:ty) => {
#[cfg(target_os = "windows")]
#[no_mangle]
extern "system" fn InitDll() -> bool {
true
}
#[cfg(target_os = "windows")]
#[no_mangle]
extern "system" fn ExitDll() -> bool {
true
}
#[cfg(target_os = "macos")]
#[no_mangle]
extern "system" fn bundleEntry(_bundle_ref: *mut std::ffi::c_void) -> bool {
true
}
#[cfg(target_os = "macos")]
#[no_mangle]
extern "system" fn bundleExit() -> bool {
true
}
#[cfg(target_os = "linux")]
#[no_mangle]
extern "system" fn ModuleEntry(_library_handle: *mut std::ffi::c_void) -> bool {
true
}
#[cfg(target_os = "linux")]
#[no_mangle]
extern "system" fn ModuleExit() -> bool {
true
}
#[no_mangle]
extern "system" fn GetPluginFactory() -> *mut std::ffi::c_void {
use vst3::ComWrapper;
use $crate::Factory;
let factory = Factory::<$component>::new(&$config);
let wrapper = ComWrapper::new(factory);
wrapper
.to_com_ptr::<vst3::Steinberg::IPluginFactory>()
.unwrap()
.into_raw() as *mut std::ffi::c_void
}
};
}