WasmFunction Class

A function (a function address).

public abstract class WasmFunction : WasmExtern
Inheritance
WasmExtern WasmFunction

Properties

NameDescription
HostStateGets the state given to WasmStore.CreateFunction for a host function, or null.
KindGets the kind of the value.
TypeGets the type of the function.

Gets the state given to WasmStore.CreateFunction for a host function, or null.

public object? HostState { get; }

Property value

object?

Gets the kind of the value.

public override WasmExternKind Kind { get; }

Property value

WasmExternKind

Type

Gets the type of the function.

public abstract WasmFunctionType Type { get; }

Property value

WasmFunctionType

Methods

NameDescription
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.cs

Invokes the function (func_invoke), and returns its results.

public WasmValue[] Call(params scoped ReadOnlySpan<WasmValue> arguments)

Parameters

arguments ReadOnlySpan<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

arguments ReadOnlySpan<WasmValue>
The arguments: one per parameter of the type.
results Span<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.