create_external_interface

Macro create_external_interface 

Source
macro_rules! create_external_interface {
    { $struct_vis:vis $interface_name:ident + $mod_name:ident => {$($func_vis:vis fn $name:ident( $( $arg_name:ident : $arg:ty),*) -> $output:ty );*;}} => { ... };
}
Expand description

creates a type definition for the external trait

a implementation of [’SourceInterface`] is auto generated by this macro

§Example

create_external_interface! {
    pub ExternalInterface + module_to_contain_it => {
        pub fn smth() -> ();
        pub fn add(num1: i32, num2: i32) -> i32;
    }
}

let interface = unsafe { ExternalInterface::from_dll_name("some_dll.dll", "ExternalInterface") };