WasmFunction Class
A function (a function address).
public abstract class WasmFunction : WasmExtern- Inheritance
WasmExternWasmFunction
Properties
| Name | Description |
|---|---|
| HostState | Gets the state given to WasmStore.CreateFunction for a host function, or null. |
| Kind | Gets the kind of the value. |
| Type | Gets the type of the function. |
HostState
WasmObjects.csGets the state given to WasmStore.CreateFunction for a host function, or null.
public object? HostState { get; }Property value
Kind
WasmObjects.csType
Methods
| Name | Description |
|---|---|
| Call(ReadOnlySpan<WasmValue>) | Invokes the function (func_invoke), and returns its results. |
| Invoke(ReadOnlySpan<WasmValue>, Span<WasmValue>) | Invokes the function (func_invoke). |
Call(ReadOnlySpan<WasmValue>)
WasmObjects.csInvokes the function (func_invoke), and returns its results.
public WasmValue[] Call(params scoped ReadOnlySpan<WasmValue> arguments)Parameters
argumentsReadOnlySpan<WasmValue>- The arguments: one per parameter of the type.
Returns
WasmValue[]
Exceptions
WasmTrapException- The execution trapped.
WasmThrowException- The function threw an exception.
WasmTypeMismatchException- An argument does not match the type of its parameter.
Invoke(ReadOnlySpan<WasmValue>, Span<WasmValue>)
Invokes the function (func_invoke).
public abstract void Invoke(ReadOnlySpan<WasmValue> arguments, Span<WasmValue> results)Parameters
argumentsReadOnlySpan<WasmValue>- The arguments: one per parameter of the type.
resultsSpan<WasmValue>- Receives the results: one per result of the type.
Exceptions
WasmTrapException- The execution trapped.
WasmThrowException- The function threw an exception.
WasmTypeMismatchException- An argument does not match the type of its parameter.