Package 'wasmer'

Title: WebAssembly Runtime for 'R' using 'Wasmer'
Description: 'R' bindings for the 'Wasmer' <https://github.com/wasmerio/wasmer/> WebAssembly runtime. This package allows you to compile, instantiate, and execute WebAssembly modules from 'R', providing a bridge between 'R' and WebAssembly for high-performance computing and interoperability.
Authors: Sounkou Mahamane Toure [aut, cre], Wasmer Authors [ctb]
Maintainer: Sounkou Mahamane Toure <[email protected]>
License: GPL-3
Version: 0.0.0.9000
Built: 2026-05-20 10:03:37 UTC
Source: https://github.com/sounkou-bioinfo/wasmer

Help Index


Call WASM function

Description

Call an exported function from a WASM instance.

Usage

wasmer_call_function_ext(ptr, instance_name, function_name, args)

Arguments

ptr

External pointer to WasmerRuntime.

instance_name

Name of the instance.

function_name

Name of the function to call.

args

Arguments as R list.

Details

Call an exported function from a WASM instance

Value

List with success flag and result or error

See Also

wasmer_call_function_safe_ext(), wasmer_host_function_example_ext(), wasmer_math_example_ext(), wasmer_hello_world_example_ext()

Other function calling: wasmer_call_function_safe_ext(), wasmer_hello_world_example_ext(), wasmer_host_function_example_ext(), wasmer_math_example_ext()

Examples

## Not run: 
wasmer_call_function_ext(ptr, "inst1", "add", list(1, 2))

## End(Not run)

Call WASM function (type safe)

Description

Call an exported WASM function with type safety and conversion.

Usage

wasmer_call_function_safe_ext(ptr, instance_name, function_name, args)

Arguments

ptr

External pointer to WasmerRuntime.

instance_name

String name of the instance.

function_name

String name of the function to call.

args

List of arguments with proper type conversion.

Details

Advanced function calling with type safety

Value

List with success flag and result or error

See Also

wasmer_call_function_ext(), wasmer_host_function_example_ext(), wasmer_math_example_ext(), wasmer_hello_world_example_ext()

Other function calling: wasmer_call_function_ext(), wasmer_hello_world_example_ext(), wasmer_host_function_example_ext(), wasmer_math_example_ext()

Examples

## Not run: 
wasmer_call_function_safe_ext(ptr, "inst1", "add", list(1, 2))

## End(Not run)

Compile WASM binary

Description

Compile a WebAssembly binary and add it to the runtime.

Usage

wasmer_compile_wasm_ext(ptr, wasm_bytes, module_name)

Arguments

ptr

External pointer to WasmerRuntime.

wasm_bytes

WASM binary as R raw vector.

module_name

Name to register the module under.

Details

Compile a WASM binary and add it to the runtime

Value

Status message

See Also

wasmer_compile_wat_ext(), wasmer_wat_to_wasm_ext()

Other module compilation: wasmer_compile_wat_ext(), wasmer_wat_to_wasm_ext()

Examples

## Not run: 
wasmer_compile_wasm_ext(ptr, wasm_bytes, "mod1")

## End(Not run)

Compile WAT module

Description

Compile a WebAssembly Text (WAT) module and add it to the runtime.

Usage

wasmer_compile_wat_ext(ptr, wat_code, module_name)

Arguments

ptr

External pointer to WasmerRuntime.

wat_code

WAT code as a string.

module_name

Name to register the module under.

Details

Compile a WAT (WebAssembly Text) module and add it to the runtime

Value

Status message

See Also

wasmer_compile_wasm_ext(), wasmer_wat_to_wasm_ext()

Other module compilation: wasmer_compile_wasm_ext(), wasmer_wat_to_wasm_ext()

Examples

## Not run: 
wasmer_compile_wat_ext(ptr, wat_code, "mod1")

## End(Not run)

Create dynamic R host function

Description

Create a Wasmer host function from an R function with dynamic signature.

Usage

wasmer_function_new_ext(ptr, rfun, arg_types, ret_types, `_name`)

Arguments

ptr

External pointer to WasmerRuntime.

rfun

R function object.

arg_types

Character vector of argument types (e.g. c("i32", "f64")).

ret_types

Character vector of return types (e.g. c("i32")).

_name

Character string for registry name.

Details

Create a Wasmer host function from an R function with dynamic signature

Value

External pointer to Function

See Also

wasmer_register_r_function_ext(), wasmer_function_new_i32_to_i32(), wasmer_function_new_i32_i32_to_i32(), wasmer_function_new_f64_f64_to_f64(), wasmer_function_new_f64_to_f64(), wasmer_function_new_i32_to_void(), wasmer_function_new_void_to_i32()

Other host function registration: wasmer_function_new_f64_f64_to_f64(), wasmer_function_new_f64_to_f64(), wasmer_function_new_i32_i32_to_i32(), wasmer_function_new_i32_to_i32(), wasmer_function_new_i32_to_void(), wasmer_function_new_void_to_i32(), wasmer_register_r_function_ext()

Examples

## Not run: 
wasmer_function_new_ext(ptr, function(x) x, c("i32"), c("i32"), "myfun")

## End(Not run)

Create host function ((f64, f64) -> f64)

Description

Create a WASM host function that takes two f64 arguments and returns an f64, using an R function as the implementation.

Usage

wasmer_function_new_f64_f64_to_f64(ptr, rfun)

Details

Create a WASM host function with signature (f64, f64) -> f64

See Also

wasmer_register_r_function_ext(), wasmer_function_new_ext(), wasmer_function_new_i32_to_i32(), wasmer_function_new_i32_i32_to_i32(), wasmer_function_new_f64_to_f64(), wasmer_function_new_i32_to_void(), wasmer_function_new_void_to_i32()

Other host function registration: wasmer_function_new_ext(), wasmer_function_new_f64_to_f64(), wasmer_function_new_i32_i32_to_i32(), wasmer_function_new_i32_to_i32(), wasmer_function_new_i32_to_void(), wasmer_function_new_void_to_i32(), wasmer_register_r_function_ext()

Examples

## Not run: 
wasmer_function_new_f64_f64_to_f64(ptr, function(x, y) x * y)

## End(Not run)

Create host function (f64 -> f64)

Description

Create a WASM host function that takes an f64 and returns an f64, using an R function as the implementation.

Usage

wasmer_function_new_f64_to_f64(ptr, rfun)

Details

Create a WASM host function with signature f64 -> f64

See Also

wasmer_register_r_function_ext(), wasmer_function_new_ext(), wasmer_function_new_i32_to_i32(), wasmer_function_new_i32_i32_to_i32(), wasmer_function_new_f64_f64_to_f64(), wasmer_function_new_i32_to_void(), wasmer_function_new_void_to_i32()

Other host function registration: wasmer_function_new_ext(), wasmer_function_new_f64_f64_to_f64(), wasmer_function_new_i32_i32_to_i32(), wasmer_function_new_i32_to_i32(), wasmer_function_new_i32_to_void(), wasmer_function_new_void_to_i32(), wasmer_register_r_function_ext()

Examples

## Not run: 
wasmer_function_new_f64_to_f64(ptr, function(x) sqrt(x))

## End(Not run)

Create host function ((i32, i32) -> i32)

Description

Create a WASM host function that takes two i32 arguments and returns an i32, using an R function as the implementation.

Usage

wasmer_function_new_i32_i32_to_i32(ptr, rfun)

Details

Create a WASM host function with signature (i32, i32) -> i32

See Also

wasmer_register_r_function_ext(), wasmer_function_new_ext(), wasmer_function_new_i32_to_i32(), wasmer_function_new_f64_f64_to_f64(), wasmer_function_new_f64_to_f64(), wasmer_function_new_i32_to_void(), wasmer_function_new_void_to_i32()

Other host function registration: wasmer_function_new_ext(), wasmer_function_new_f64_f64_to_f64(), wasmer_function_new_f64_to_f64(), wasmer_function_new_i32_to_i32(), wasmer_function_new_i32_to_void(), wasmer_function_new_void_to_i32(), wasmer_register_r_function_ext()

Examples

## Not run: 
wasmer_function_new_i32_i32_to_i32(ptr, function(x, y) x + y)

## End(Not run)

Create host function (i32 -> i32)

Description

Create a WASM host function that takes an i32 and returns an i32, using an R function as the implementation.

Usage

wasmer_function_new_i32_to_i32(ptr, rfun)

Details

Create a WASM host function with signature i32 -> i32

See Also

wasmer_register_r_function_ext(), wasmer_function_new_ext(), wasmer_function_new_i32_i32_to_i32(), wasmer_function_new_f64_f64_to_f64(), wasmer_function_new_f64_to_f64(), wasmer_function_new_i32_to_void(), wasmer_function_new_void_to_i32()

Other host function registration: wasmer_function_new_ext(), wasmer_function_new_f64_f64_to_f64(), wasmer_function_new_f64_to_f64(), wasmer_function_new_i32_i32_to_i32(), wasmer_function_new_i32_to_void(), wasmer_function_new_void_to_i32(), wasmer_register_r_function_ext()

Examples

## Not run: 
wasmer_function_new_i32_to_i32(ptr, function(x) x)

## End(Not run)

Create host function (i32 -> void)

Description

Create a WASM host function that takes an i32 and returns nothing, using an R function as the implementation.

Usage

wasmer_function_new_i32_to_void(ptr, rfun)

Details

Create a WASM host function with signature i32 -> void

See Also

wasmer_register_r_function_ext(), wasmer_function_new_ext(), wasmer_function_new_i32_to_i32(), wasmer_function_new_i32_i32_to_i32(), wasmer_function_new_f64_f64_to_f64(), wasmer_function_new_f64_to_f64(), wasmer_function_new_void_to_i32()

Other host function registration: wasmer_function_new_ext(), wasmer_function_new_f64_f64_to_f64(), wasmer_function_new_f64_to_f64(), wasmer_function_new_i32_i32_to_i32(), wasmer_function_new_i32_to_i32(), wasmer_function_new_void_to_i32(), wasmer_register_r_function_ext()

Examples

## Not run: 
wasmer_function_new_i32_to_void(ptr, function(x) cat(x))

## End(Not run)

Create host function (void -> i32)

Description

Create a WASM host function that takes no arguments and returns an i32, using an R function as the implementation.

Usage

wasmer_function_new_void_to_i32(ptr, rfun)

Details

Create a WASM host function with signature void -> i32

See Also

wasmer_register_r_function_ext(), wasmer_function_new_ext(), wasmer_function_new_i32_to_i32(), wasmer_function_new_i32_i32_to_i32(), wasmer_function_new_f64_f64_to_f64(), wasmer_function_new_f64_to_f64(), wasmer_function_new_i32_to_void()

Other host function registration: wasmer_function_new_ext(), wasmer_function_new_f64_f64_to_f64(), wasmer_function_new_f64_to_f64(), wasmer_function_new_i32_i32_to_i32(), wasmer_function_new_i32_to_i32(), wasmer_function_new_i32_to_void(), wasmer_register_r_function_ext()

Examples

## Not run: 
wasmer_function_new_void_to_i32(ptr, function() 42)

## End(Not run)

Get exported WASM Table

Description

Get a pointer to an exported table from a WASM instance by name.

Usage

wasmer_get_exported_table_ext(ptr, instance_name, table_export_name)

Arguments

ptr

External pointer to WasmerRuntime.

instance_name

Name of the instance.

table_export_name

Name of the exported table.

Details

Get a pointer to an exported table from a WASM instance by name

Value

External pointer to Table, or NULL if not found

See Also

wasmer_table_new_ext(), wasmer_table_set_ext(), wasmer_table_grow_ext(), wasmer_table_get_ext()

Other table operations: wasmer_table_get_ext(), wasmer_table_grow_ext(), wasmer_table_new_ext(), wasmer_table_set_ext()

Examples

## Not run: 
wasmer_get_exported_table_ext(ptr, "inst1", "table1")

## End(Not run)

Hello World example

Description

Create a simple WASM "Hello World" example.

Usage

wasmer_hello_world_example_ext(ptr)

Arguments

ptr

External pointer to WasmerRuntime.

Details

Create a simple "Hello World" example

Value

String result from WASM hello function

See Also

wasmer_call_function_ext(), wasmer_call_function_safe_ext(), wasmer_host_function_example_ext(), wasmer_math_example_ext()

Other function calling: wasmer_call_function_ext(), wasmer_call_function_safe_ext(), wasmer_host_function_example_ext(), wasmer_math_example_ext()

Examples

## Not run: 
wasmer_hello_world_example_ext(ptr)

## End(Not run)

Host function example

Description

Example with host function imports.

Usage

wasmer_host_function_example_ext(ptr)

Arguments

ptr

External pointer to WasmerRuntime.

Details

Example with host function imports

Value

List with results

See Also

wasmer_call_function_ext(), wasmer_call_function_safe_ext(), wasmer_math_example_ext(), wasmer_hello_world_example_ext()

Other function calling: wasmer_call_function_ext(), wasmer_call_function_safe_ext(), wasmer_hello_world_example_ext(), wasmer_math_example_ext()

Examples

## Not run: 
wasmer_host_function_example_ext(ptr)

## End(Not run)

Instantiate a compiled module in the runtime.

Description

Instantiate a compiled module in the runtime.

Usage

wasmer_instantiate_ext(ptr, module_name, instance_name)

Arguments

ptr

External pointer to WasmerRuntime

module_name

Name of the module to instantiate

instance_name

Name to register the instance under

Value

Status message


Instantiate WASM module with math imports

Description

Instantiate a WASM module with host functions for mathematical operations.

Usage

wasmer_instantiate_with_math_imports_ext(ptr, module_name, instance_name)

Arguments

ptr

External pointer to WasmerRuntime.

module_name

String name of the module to instantiate.

instance_name

String name to identify this instance.

Details

Create an instance with host functions for mathematical operations

Value

Status message

See Also

wasmer_instantiate_ext(), wasmer_instantiate_with_table_ext(), wasmer_wasi_state_new_ext()

Other module instantiation: wasmer_instantiate_with_table_ext(), wasmer_wasi_state_new_ext()

Examples

## Not run: 
wasmer_instantiate_with_math_imports_ext(ptr, "mod1", "inst1")

## End(Not run)

Instantiate WASM module with table import

Description

Instantiate a compiled WASM module in the runtime, with a custom table import.

Usage

wasmer_instantiate_with_table_ext(ptr, module_name, instance_name, table_ptr)

Arguments

ptr

External pointer to WasmerRuntime.

module_name

Name of the module to instantiate.

instance_name

Name to register the instance under.

table_ptr

External pointer to Table to import as "env.host_table".

Details

Instantiate a compiled module in the runtime, with a custom table import

Value

Status message

See Also

wasmer_instantiate_ext(), wasmer_instantiate_with_math_imports_ext(), wasmer_wasi_state_new_ext()

Other module instantiation: wasmer_instantiate_with_math_imports_ext(), wasmer_wasi_state_new_ext()

Examples

## Not run: 
wasmer_instantiate_with_table_ext(ptr, "mod1", "inst1", table_ptr)

## End(Not run)

List WASM exports

Description

List all exports from a WASM instance.

Usage

wasmer_list_exports_ext(ptr, instance_name)

Arguments

ptr

External pointer to WasmerRuntime.

instance_name

Name of the instance.

Details

List all exports from a WASM instance

Value

List with success flag and exports or error

See Also

wasmer_list_function_signatures_ext()

Other exports and signatures: wasmer_list_function_signatures_ext()

Examples

## Not run: 
wasmer_list_exports_ext(ptr, "inst1")

## End(Not run)

List WASM function signatures

Description

List exported function signatures (name, input types, output types) for a WASM instance.

Usage

wasmer_list_function_signatures_ext(ptr, instance_name)

Arguments

ptr

External pointer to WasmerRuntime.

instance_name

Name of the instance.

Details

List exported function signatures (name, input types, output types) for a WASM instance

Value

Data frame with columns: name, params, results

See Also

wasmer_list_exports_ext()

Other exports and signatures: wasmer_list_exports_ext()

Examples

## Not run: 
wasmer_list_function_signatures_ext(ptr, "inst1")

## End(Not run)

Math operations example

Description

Example WASM module for math operations.

Usage

wasmer_math_example_ext(ptr, a, b)

Arguments

ptr

External pointer to WasmerRuntime.

a

First integer.

b

Second integer.

Details

Math operations example

Value

List with results of add and multiply

See Also

wasmer_call_function_ext(), wasmer_call_function_safe_ext(), wasmer_host_function_example_ext(), wasmer_hello_world_example_ext()

Other function calling: wasmer_call_function_ext(), wasmer_call_function_safe_ext(), wasmer_hello_world_example_ext(), wasmer_host_function_example_ext()

Examples

## Not run: 
wasmer_math_example_ext(ptr, 2, 3)

## End(Not run)

Grow WASM memory

Description

Grow WASM memory by a number of pages.

Usage

wasmer_memory_grow_ext(ptr, instance_name, memory_name, pages)

Arguments

ptr

External pointer to WasmerRuntime.

instance_name

Name of the instance.

memory_name

Name of the exported memory.

pages

Number of pages to grow.

Details

Grow WASM memory by a number of pages

Value

TRUE if successful

See Also

wasmer_memory_size_ext(), wasmer_memory_read_ext(), wasmer_memory_write_ext(), wasmer_memory_read_string_ext()

Other memory operations: wasmer_memory_read_ext(), wasmer_memory_read_string_ext(), wasmer_memory_size_ext(), wasmer_memory_write_ext()

Examples

## Not run: 
wasmer_memory_grow_ext(ptr, "inst1", "memory", 1)

## End(Not run)

Read WASM memory

Description

Read bytes from WASM memory.

Usage

wasmer_memory_read_ext(ptr, instance_name, memory_name, offset, length)

Arguments

ptr

External pointer to WasmerRuntime.

instance_name

Name of the instance.

memory_name

Name of the exported memory.

offset

Offset to start reading.

length

Number of bytes to read.

Details

Read bytes from WASM memory

Value

Raw vector of bytes

See Also

wasmer_memory_size_ext(), wasmer_memory_write_ext(), wasmer_memory_read_string_ext(), wasmer_memory_grow_ext()

Other memory operations: wasmer_memory_grow_ext(), wasmer_memory_read_string_ext(), wasmer_memory_size_ext(), wasmer_memory_write_ext()

Examples

## Not run: 
wasmer_memory_read_ext(ptr, "inst1", "memory", 0, 10)

## End(Not run)

Read WASM memory as string

Description

Read UTF-8 string from WASM memory.

Usage

wasmer_memory_read_string_ext(ptr, instance_name, memory_name, offset, length)

Arguments

ptr

External pointer to WasmerRuntime.

instance_name

Name of the instance.

memory_name

Name of the exported memory.

offset

Offset to start reading.

length

Number of bytes to read.

Details

Read UTF-8 string from WASM memory

Value

String

See Also

wasmer_memory_size_ext(), wasmer_memory_read_ext(), wasmer_memory_write_ext(), wasmer_memory_grow_ext()

Other memory operations: wasmer_memory_grow_ext(), wasmer_memory_read_ext(), wasmer_memory_size_ext(), wasmer_memory_write_ext()

Examples

## Not run: 
wasmer_memory_read_string_ext(ptr, "inst1", "memory", 0, 10)

## End(Not run)

Get WASM memory size

Description

Get the size of exported memory (in bytes and pages).

Usage

wasmer_memory_size_ext(ptr, instance_name, memory_name)

Arguments

ptr

External pointer to WasmerRuntime.

instance_name

Name of the instance.

memory_name

Name of the exported memory (default "memory").

Details

Get the size of exported memory (in bytes and pages)

Value

List with size_bytes and size_pages

See Also

wasmer_memory_read_ext(), wasmer_memory_write_ext(), wasmer_memory_read_string_ext(), wasmer_memory_grow_ext()

Other memory operations: wasmer_memory_grow_ext(), wasmer_memory_read_ext(), wasmer_memory_read_string_ext(), wasmer_memory_write_ext()

Examples

## Not run: 
wasmer_memory_size_ext(ptr, "inst1", "memory")

## End(Not run)

Write WASM memory

Description

Write bytes to WASM memory.

Usage

wasmer_memory_write_ext(ptr, instance_name, memory_name, offset, bytes)

Arguments

ptr

External pointer to WasmerRuntime.

instance_name

Name of the instance.

memory_name

Name of the exported memory.

offset

Offset to start writing.

bytes

Raw vector of bytes to write.

Details

Write bytes to WASM memory

Value

TRUE if successful

See Also

wasmer_memory_size_ext(), wasmer_memory_read_ext(), wasmer_memory_read_string_ext(), wasmer_memory_grow_ext()

Other memory operations: wasmer_memory_grow_ext(), wasmer_memory_read_ext(), wasmer_memory_read_string_ext(), wasmer_memory_size_ext()

Examples

## Not run: 
wasmer_memory_write_ext(ptr, "inst1", "memory", 0, as.raw(c(1,2,3)))

## End(Not run)

Register R host function

Description

Register an R function for use as a host function in WASM (per-runtime).

Usage

wasmer_register_r_function_ext(ptr, name, fun)

Arguments

ptr

External pointer to WasmerRuntime.

fun

R function object.

_name

Name to register the function under.

Details

Register an R function for use as a host function in WASM (per-runtime)

Value

TRUE if successful

See Also

wasmer_function_new_ext(), wasmer_function_new_i32_to_i32(), wasmer_function_new_i32_i32_to_i32(), wasmer_function_new_f64_f64_to_f64(), wasmer_function_new_f64_to_f64(), wasmer_function_new_i32_to_void(), wasmer_function_new_void_to_i32()

Other host function registration: wasmer_function_new_ext(), wasmer_function_new_f64_f64_to_f64(), wasmer_function_new_f64_to_f64(), wasmer_function_new_i32_i32_to_i32(), wasmer_function_new_i32_to_i32(), wasmer_function_new_i32_to_void(), wasmer_function_new_void_to_i32()

Examples

## Not run: 
wasmer_register_r_function_ext(ptr, "myfun", function(x) x)

## End(Not run)

Create a new Wasmer runtime

Description

Create a new Wasmer runtime for executing WebAssembly modules.

Usage

wasmer_runtime_new()

Details

Create a new Wasmer runtime

Value

External pointer to WasmerRuntime

See Also

wasmer_runtime_new_with_compiler_ext(), wasmer_runtime_release_ressources()

Other runtime management: wasmer_runtime_new_with_compiler_ext(), wasmer_runtime_release_ressources()

Examples

## Not run: 
ptr <- wasmer_runtime_new()

## End(Not run)

Create a new Wasmer runtime with a specific compiler

Description

Create a new Wasmer runtime for executing WebAssembly modules using a specified compiler backend.

Usage

wasmer_runtime_new_with_compiler_ext(compiler_name)

Arguments

compiler_name

Name of the compiler ("cranelift", "singlepass").

Details

Create a new Wasmer runtime with a specific compiler

Value

External pointer to WasmerRuntime

See Also

wasmer_runtime_new(), wasmer_runtime_release_ressources()

Other runtime management: wasmer_runtime_new(), wasmer_runtime_release_ressources()

Examples

## Not run: 
ptr <- wasmer_runtime_new_with_compiler_ext("cranelift")

## End(Not run)

Release Wasmer runtime resources

Description

Explicitly shutdown the runtime, free resources, and clear the R external pointer.

Usage

wasmer_runtime_release_ressources(ptr)

Arguments

ptr

External pointer to WasmerRuntime.

Details

Release resources held by the Wasmer runtime

Value

NULL (invisible)

See Also

wasmer_runtime_new(), wasmer_runtime_new_with_compiler_ext()

Other runtime management: wasmer_runtime_new(), wasmer_runtime_new_with_compiler_ext()

Examples

## Not run: 
wasmer_runtime_release_ressources(ptr)

## End(Not run)

Get WASM Table entry

Description

Get a function reference from a WASM Table.

Usage

wasmer_table_get_ext(ptr, table_ptr, index)

Arguments

ptr

External pointer to WasmerRuntime.

table_ptr

External pointer to Table.

index

Index to get.

Details

Get a function reference from a WASM Table

Value

External pointer to Function (or NULL)

See Also

wasmer_table_new_ext(), wasmer_table_set_ext(), wasmer_table_grow_ext(), wasmer_get_exported_table_ext()

Other table operations: wasmer_get_exported_table_ext(), wasmer_table_grow_ext(), wasmer_table_new_ext(), wasmer_table_set_ext()

Examples

## Not run: 
wasmer_table_get_ext(ptr, table_ptr, 0)

## End(Not run)

Grow WASM Table

Description

Grow a WASM Table by a number of elements.

Usage

wasmer_table_grow_ext(ptr, table_ptr, delta, func_ptr)

Arguments

ptr

External pointer to WasmerRuntime.

table_ptr

External pointer to Table.

delta

Number of elements to grow.

func_ptr

External pointer to Function to fill new slots.

Details

Grow a WASM Table

Value

Previous size

See Also

wasmer_table_new_ext(), wasmer_table_set_ext(), wasmer_table_get_ext(), wasmer_get_exported_table_ext()

Other table operations: wasmer_get_exported_table_ext(), wasmer_table_get_ext(), wasmer_table_new_ext(), wasmer_table_set_ext()

Examples

## Not run: 
wasmer_table_grow_ext(ptr, table_ptr, 1, func_ptr)

## End(Not run)

Create WASM Table

Description

Create a new WASM Table.

Usage

wasmer_table_new_ext(ptr, min, max)

Arguments

ptr

External pointer to WasmerRuntime.

min

Minimum size.

max

Maximum size (optional).

Details

Create a new WASM Table

Value

External pointer to Table

See Also

wasmer_table_set_ext(), wasmer_table_grow_ext(), wasmer_table_get_ext(), wasmer_get_exported_table_ext()

Other table operations: wasmer_get_exported_table_ext(), wasmer_table_get_ext(), wasmer_table_grow_ext(), wasmer_table_set_ext()

Examples

## Not run: 
wasmer_table_new_ext(ptr, 1, 10)

## End(Not run)

Set WASM Table entry

Description

Set a function reference in a WASM Table.

Usage

wasmer_table_set_ext(ptr, table_ptr, index, func_ptr)

Arguments

ptr

External pointer to WasmerRuntime.

table_ptr

External pointer to Table.

index

Index to set.

func_ptr

External pointer to Function.

Details

Set a function reference in a WASM Table

Value

TRUE if successful

See Also

wasmer_table_new_ext(), wasmer_table_grow_ext(), wasmer_table_get_ext(), wasmer_get_exported_table_ext()

Other table operations: wasmer_get_exported_table_ext(), wasmer_table_get_ext(), wasmer_table_grow_ext(), wasmer_table_new_ext()

Examples

## Not run: 
wasmer_table_set_ext(ptr, table_ptr, 0, func_ptr)

## End(Not run)

Create WASI/WASIX state

Description

Create a WASI or WASIX state for the runtime.

Usage

wasmer_wasi_state_new_ext(ptr, module_name, env_type)

Arguments

ptr

External pointer to WasmerRuntime.

module_name

Name of the module (for WASI/WASIX args).

env_type

Environment type: "wasi" (default) or "wasix".

Details

Create a WASI or WASIX state for the runtime

Value

TRUE if successful, FALSE otherwise

See Also

wasmer_instantiate_ext(), wasmer_instantiate_with_math_imports_ext(), wasmer_instantiate_with_table_ext()

Other module instantiation: wasmer_instantiate_with_math_imports_ext(), wasmer_instantiate_with_table_ext()

Examples

## Not run: 
wasmer_wasi_state_new_ext(ptr, "mod1", "wasi")

## End(Not run)

Convert WAT to WASM

Description

Convert WebAssembly Text (WAT) to WASM binary and return as R raw vector.

Usage

wasmer_wat_to_wasm_ext(wat_code)

Arguments

wat_code

WAT code as a string.

Details

Convert WAT (WebAssembly Text) to WASM binary and return as R raw vector

Value

WASM binary as R raw vector, or error string if conversion fails

See Also

wasmer_compile_wat_ext(), wasmer_compile_wasm_ext()

Other module compilation: wasmer_compile_wasm_ext(), wasmer_compile_wat_ext()

Examples

## Not run: 
wasmer_wat_to_wasm_ext(wat_code)

## End(Not run)