diff options
Diffstat (limited to 'zluda/src/lib.rs')
-rw-r--r-- | zluda/src/lib.rs | 46 |
1 files changed, 36 insertions, 10 deletions
diff --git a/zluda/src/lib.rs b/zluda/src/lib.rs index 9986051..9a6c402 100644 --- a/zluda/src/lib.rs +++ b/zluda/src/lib.rs @@ -1,11 +1,37 @@ -extern crate lazy_static; -#[cfg(test)] -extern crate cuda_driver_sys; -#[cfg(test)] -extern crate paste; -extern crate ptx; - -#[allow(warnings)] -pub mod cuda; -mod cuda_impl; pub(crate) mod r#impl; + +macro_rules! unimplemented { + ($($abi:literal fn $fn_name:ident( $($arg_id:ident : $arg_type:ty),* ) -> $ret_type:path;)*) => { + $( + #[cfg_attr(not(test), no_mangle)] + #[allow(improper_ctypes)] + #[allow(improper_ctypes_definitions)] + pub unsafe extern $abi fn $fn_name ( $( $arg_id : $arg_type),* ) -> $ret_type { + crate::r#impl::unimplemented() + } + )* + }; +} + +macro_rules! implemented { + ($($abi:literal fn $fn_name:ident( $($arg_id:ident : $arg_type:ty),* ) -> $ret_type:path;)*) => { + $( + #[cfg_attr(not(test), no_mangle)] + #[allow(improper_ctypes)] + #[allow(improper_ctypes_definitions)] + pub unsafe extern $abi fn $fn_name ( $( $arg_id : $arg_type),* ) -> $ret_type { + cuda_base::cuda_normalize_fn!( crate::r#impl::$fn_name ) ($(crate::r#impl::FromCuda::from_cuda($arg_id)?),*)?; + Ok(()) + } + )* + }; +} + + +use cuda_base::cuda_function_declarations; +cuda_function_declarations!( + unimplemented, + implemented <= [ + cuInit + ] +);
\ No newline at end of file |