Macro interoptopus::pattern_api_entry [−][src]
macro_rules! pattern_api_entry { ( $struct:ident, $init:ident, [ $($function:ident),* ] ) => { ... }; }
Expand description
Defines a new API entry function and corresponding struct.
The resulting function can be called via FFI and will return a struct, pointing to all exported functions.
Example
In this example, other languages can call my_api_init_v1
to obtain a struct of type MyAPIv1
exporting f1
and f2
.
use interoptopus::{pattern_api_entry, ffi_function}; #[ffi_function] extern "C" fn f1() {} #[ffi_function] extern "C" fn f2() {} pattern_api_entry!(MyAPIv1, my_api_init_v1, [f1, f2]);