1#[macro_export]
2macro_rules! generate_bindings {
3 ($(binding $static_name:ident fn $binding_name:ident($($parameter_name:ident:$parameter_type:ty),*) $(-> $return_type:ty)?;)*) => {
4 $(
5 static $static_name: once_cell::sync::Lazy<libloading::Symbol<'static, extern "system" fn($($parameter_name: $parameter_type),*) $(-> $return_type)?>> = once_cell::sync::Lazy::new(|| {
6 if let Ok(function) = unsafe { BASS_LIBRARY.get(stringify!($binding_name).as_bytes()) } {
7 return function;
8 } else {
9 panic!("Failed to load the function.");
10 }
11 });
12
13 #[allow(non_snake_case)]
14 pub fn $binding_name($($parameter_name: $parameter_type),*) $(-> $return_type)? {
15 $static_name($($parameter_name),*)
16 }
17 )*
18 };
19}