polywrap_wasm.imports.invoke module

This module contains the imports for the invoke family of functions.

class polywrap_wasm.imports.invoke.WrapInvokeImports[source]

Bases: BaseWrapImports

Defines the invoke family of imports for the Wasm module.

wrap_invoke_args(method_ptr: int, args_ptr: int) None[source]

Write the method and args of the function to be invoked in the shared memory at Wasm allocated empty method and args slots.

Parameters:
  • method_ptr (int) – The pointer to the empty method name string slot in memory.

  • args_ptr (int) – The pointer to the empty method args bytes slot in memory.

Raises:

WasmAbortError – if the method or args are not set from the host.

wrap_invoke_error(ptr: int, length: int)[source]

Read and store the error of the invoked Wasm function written in the shared memory by the Wasm module in the state.

Parameters:
  • ptr (int) – The pointer to the error string in memory.

  • length (int) – The length of the error string in memory.

wrap_invoke_result(ptr: int, length: int) None[source]

Read and store the result of the invoked Wasm function written in the shared memory by the Wasm module in the state.

Parameters:
  • ptr (int) – The pointer to the result bytes in memory.

  • length (int) – The length of the result bytes in memory.