[][src]Attribute Macro lucet_runtime_macros::lucet_hostcall


This attribute generates a Lucet hostcall from a standalone Rust function that takes a &mut Vmctx as its first argument.

It is important to use this attribute for hostcalls, rather than exporting them directly. Otherwise the behavior of instance termination and timeouts are undefined. Additionally, the attribute makes the resulting function unsafe extern "C" regardless of how the function is defined, as this ABI is required for all hostcalls.

In most cases, you will want to also provide the #[no_mangle] attribute and pub visibility in order for the hostcall to be exported from the final executable.

This example is not tested
pub fn yield_5(vmctx: &mut Vmctx) {

Note that lucet-runtime must be a dependency of any crate where this attribute is used, and it may not be renamed (this restriction may be lifted once this issue is resolved).