Macro wasmtime_plugin_guest_derive::import_functions[][src]

import_functions!() { /* proc-macro */ }
Expand description

Import functions from the host program. The function’s arguments an return type must all be serializable. Several functions can be imported at once by listing their signatures seperated by ;

import_functions! {
    fn my_function();
    fn my_other_function(s: String) -> Vec<u8>;
}

The macro creates a safe wrapper function using the given name which can be called in the plugin code. The actual imported function, which normal code will never need to access, will have a mangled name: wasm_plugin_imported__ORIGINAL_NAME and is only intended to be called by by host code using wasmtime_plugin_host