Wasmer::Function
Inherits Wasmer::WithExtern / Reference / Object
Function is a WebAssembly function instance
A function instance is the runtime representation of a function.
It effectively is a closure of the original function (defined in either
the host or the WebAssembly module) over the runtime Instance of its
originating Module.
The module instance is used to resolve references to other definitions during execution of the function.
Spec: https://webassembly.github.io/spec/core/exec/runtime.html#function-instances
Constructors
Instantiates a new Function in the given Store.
It takes four arguments, the Store, the FunctionType,
host environment and the definition for the Function.
environment can be anything. It is Pointer(Void)
The function definition must be a native Crystal function with a Value array
as its single argument. The function must return a Value array or
raise an exception for abnormal conditions.
Note: Even if the function does not take any argument (or use any argument)
it must receive a Value array as its single argument. At runtime, this array will be empty.
The same applies to the result.
Instantiates a new Function in the given Store.
It takes three arguments, the Store, the FunctionType and the
definition for the Function.
The function definition must be a native Crystal function with a Value array
as its single argument. The function must return a Value array or
raise an exception for abnormal conditions.
Note: Even if the function does not take any argument (or use any argument)
it must receive a Value array as its single argument. At runtime, this array will be empty.
The same applies to the result.