wasmtime_func_new_unchecked function
- @Native<Void Function(Pointer<
wasmtime_context_t> , Pointer<wasm_functype_t> , wasmtime_func_unchecked_callback_t, Pointer<Void> , Pointer<NativeFunction< , Pointer<Void Function(Pointer< >Void> )>wasmtime_func_t> )>(ffi.Pointer<wasmtime_context_t>, ffi.Pointer<wasm_functype_t>, wasmtime_func_unchecked_callback_t, ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>, ffi.Pointer<wasmtime_func_t>)>()
- Pointer<
wasmtime_context_t> store, - Pointer<
wasm_functype_t> type, - wasmtime_func_unchecked_callback_t callback,
- Pointer<
Void> env, - Pointer<
NativeFunction< finalizer,Void Function(Pointer< >Void> )> - Pointer<
wasmtime_func_t> ret,
\brief Creates a new host function in the same manner of #wasmtime_func_new, but the function-to-call has no type information available at runtime.
This function is very similar to #wasmtime_func_new. The difference is that this version is "more unsafe" in that when the host callback is invoked there is no type information and no checks that the right types of values are produced. The onus is on the consumer of this API to ensure that all invariants are upheld such as:
- The host callback reads parameters correctly and interprets their types correctly.
- If a trap doesn't happen then all results are written to the results pointer. All results must have the correct type.
- Types such as
funcrefcannot cross stores. - Types such as
externrefhave valid reference counts.
It's generally only recommended to use this if your application can wrap this in a safe embedding. This should not be frequently used due to the number of invariants that must be upheld on the wasm<->host boundary. On the upside, though, this flavor of host function will be faster to call than those created by #wasmtime_func_new (hence the reason for this function's existence).
Implementation
@ffi.Native<
ffi.Void Function(
ffi.Pointer<wasmtime_context_t>,
ffi.Pointer<wasm_functype_t>,
wasmtime_func_unchecked_callback_t,
ffi.Pointer<ffi.Void>,
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>,
ffi.Pointer<wasmtime_func_t>,
)
>()
external void wasmtime_func_new_unchecked(
ffi.Pointer<wasmtime_context_t> store,
ffi.Pointer<wasm_functype_t> type,
wasmtime_func_unchecked_callback_t callback,
ffi.Pointer<ffi.Void> env,
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>
finalizer,
ffi.Pointer<wasmtime_func_t> ret,
);