wasmtime_func_call function

  1. @Native<Pointer<wasmtime_error_t> Function(Pointer<wasmtime_context_t>, Pointer<wasmtime_func_t>, Pointer<wasmtime_val_t>, Size, Pointer<wasmtime_val_t>, Size, Pointer<Pointer<wasm_trap_t>>)>(ffi.Pointer<wasmtime_context_t>, ffi.Pointer<wasmtime_func_t>, ffi.Pointer<wasmtime_val_t>, ffi.Size, ffi.Pointer<wasmtime_val_t>, ffi.Size, ffi.Pointer<ffi.Pointer<wasm_trap_t>>)>()
Pointer<wasmtime_error_t> wasmtime_func_call(
  1. Pointer<wasmtime_context_t> store,
  2. Pointer<wasmtime_func_t> func,
  3. Pointer<wasmtime_val_t> args,
  4. int nargs,
  5. Pointer<wasmtime_val_t> results,
  6. int nresults,
  7. Pointer<Pointer<wasm_trap_t>> trap,
)

\brief Call a WebAssembly function.

This function is used to invoke a function defined within a store. For example this might be used after extracting a function from a #wasmtime_instance_t.

\param store the store which owns func \param func the function to call \param args the arguments to the function call \param nargs the number of arguments provided \param results where to write the results of the function call \param nresults the number of results expected \param trap where to store a trap, if one happens.

There are three possible return states from this function:

  1. The returned error is non-null. This means results wasn't written to and trap will have NULL written to it. This state means that programmer error happened when calling the function, for example when the size of the arguments/results was wrong, the types of the arguments were wrong, or arguments may come from the wrong store.
  2. The trap pointer is filled in. This means the returned error is NULL and results was not written to. This state means that the function was executing but hit a wasm trap while executing.
  3. The error and trap returned are both NULL and results are written to. This means that the function call succeeded and the specified results were produced.

The trap pointer cannot be NULL. The args and results pointers may be NULL if the corresponding length is zero.

Does not take ownership of #wasmtime_val_t arguments. Gives ownership of #wasmtime_val_t results.

Implementation

@ffi.Native<
  ffi.Pointer<wasmtime_error_t> Function(
    ffi.Pointer<wasmtime_context_t>,
    ffi.Pointer<wasmtime_func_t>,
    ffi.Pointer<wasmtime_val_t>,
    ffi.Size,
    ffi.Pointer<wasmtime_val_t>,
    ffi.Size,
    ffi.Pointer<ffi.Pointer<wasm_trap_t>>,
  )
>()
external ffi.Pointer<wasmtime_error_t> wasmtime_func_call(
  ffi.Pointer<wasmtime_context_t> store,
  ffi.Pointer<wasmtime_func_t> func,
  ffi.Pointer<wasmtime_val_t> args,
  int nargs,
  ffi.Pointer<wasmtime_val_t> results,
  int nresults,
  ffi.Pointer<ffi.Pointer<wasm_trap_t>> trap,
);