| 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 |
Call an exported function from a WASM instance.
wasmer_call_function_ext(ptr, instance_name, function_name, args)wasmer_call_function_ext(ptr, instance_name, function_name, args)
ptr |
External pointer to WasmerRuntime. |
instance_name |
Name of the instance. |
function_name |
Name of the function to call. |
args |
Arguments as R list. |
Call an exported function from a WASM instance
List with success flag and result or error
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()
## Not run: wasmer_call_function_ext(ptr, "inst1", "add", list(1, 2)) ## End(Not run)## Not run: wasmer_call_function_ext(ptr, "inst1", "add", list(1, 2)) ## End(Not run)
Call an exported WASM function with type safety and conversion.
wasmer_call_function_safe_ext(ptr, instance_name, function_name, args)wasmer_call_function_safe_ext(ptr, instance_name, function_name, args)
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. |
Advanced function calling with type safety
List with success flag and result or error
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()
## Not run: wasmer_call_function_safe_ext(ptr, "inst1", "add", list(1, 2)) ## End(Not run)## Not run: wasmer_call_function_safe_ext(ptr, "inst1", "add", list(1, 2)) ## End(Not run)
Compile a WebAssembly binary and add it to the runtime.
wasmer_compile_wasm_ext(ptr, wasm_bytes, module_name)wasmer_compile_wasm_ext(ptr, wasm_bytes, module_name)
ptr |
External pointer to WasmerRuntime. |
wasm_bytes |
WASM binary as R raw vector. |
module_name |
Name to register the module under. |
Compile a WASM binary and add it to the runtime
Status message
wasmer_compile_wat_ext(), wasmer_wat_to_wasm_ext()
Other module compilation:
wasmer_compile_wat_ext(),
wasmer_wat_to_wasm_ext()
## Not run: wasmer_compile_wasm_ext(ptr, wasm_bytes, "mod1") ## End(Not run)## Not run: wasmer_compile_wasm_ext(ptr, wasm_bytes, "mod1") ## End(Not run)
Compile a WebAssembly Text (WAT) module and add it to the runtime.
wasmer_compile_wat_ext(ptr, wat_code, module_name)wasmer_compile_wat_ext(ptr, wat_code, module_name)
ptr |
External pointer to WasmerRuntime. |
wat_code |
WAT code as a string. |
module_name |
Name to register the module under. |
Compile a WAT (WebAssembly Text) module and add it to the runtime
Status message
wasmer_compile_wasm_ext(), wasmer_wat_to_wasm_ext()
Other module compilation:
wasmer_compile_wasm_ext(),
wasmer_wat_to_wasm_ext()
## Not run: wasmer_compile_wat_ext(ptr, wat_code, "mod1") ## End(Not run)## Not run: wasmer_compile_wat_ext(ptr, wat_code, "mod1") ## End(Not run)
Create a Wasmer host function from an R function with dynamic signature.
wasmer_function_new_ext(ptr, rfun, arg_types, ret_types, `_name`)wasmer_function_new_ext(ptr, rfun, arg_types, ret_types, `_name`)
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. |
Create a Wasmer host function from an R function with dynamic signature
External pointer to Function
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()
## Not run: wasmer_function_new_ext(ptr, function(x) x, c("i32"), c("i32"), "myfun") ## End(Not run)## Not run: wasmer_function_new_ext(ptr, function(x) x, c("i32"), c("i32"), "myfun") ## End(Not run)
Create a WASM host function that takes two f64 arguments and returns an f64, using an R function as the implementation.
wasmer_function_new_f64_f64_to_f64(ptr, rfun)wasmer_function_new_f64_f64_to_f64(ptr, rfun)
Create a WASM host function with signature (f64, f64) -> f64
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()
## Not run: wasmer_function_new_f64_f64_to_f64(ptr, function(x, y) x * y) ## End(Not run)## Not run: wasmer_function_new_f64_f64_to_f64(ptr, function(x, y) x * y) ## End(Not run)
Create a WASM host function that takes an f64 and returns an f64, using an R function as the implementation.
wasmer_function_new_f64_to_f64(ptr, rfun)wasmer_function_new_f64_to_f64(ptr, rfun)
Create a WASM host function with signature f64 -> f64
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()
## Not run: wasmer_function_new_f64_to_f64(ptr, function(x) sqrt(x)) ## End(Not run)## Not run: wasmer_function_new_f64_to_f64(ptr, function(x) sqrt(x)) ## End(Not run)
Create a WASM host function that takes two i32 arguments and returns an i32, using an R function as the implementation.
wasmer_function_new_i32_i32_to_i32(ptr, rfun)wasmer_function_new_i32_i32_to_i32(ptr, rfun)
Create a WASM host function with signature (i32, i32) -> i32
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()
## Not run: wasmer_function_new_i32_i32_to_i32(ptr, function(x, y) x + y) ## End(Not run)## Not run: wasmer_function_new_i32_i32_to_i32(ptr, function(x, y) x + y) ## End(Not run)
Create a WASM host function that takes an i32 and returns an i32, using an R function as the implementation.
wasmer_function_new_i32_to_i32(ptr, rfun)wasmer_function_new_i32_to_i32(ptr, rfun)
Create a WASM host function with signature i32 -> i32
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()
## Not run: wasmer_function_new_i32_to_i32(ptr, function(x) x) ## End(Not run)## Not run: wasmer_function_new_i32_to_i32(ptr, function(x) x) ## End(Not run)
Create a WASM host function that takes an i32 and returns nothing, using an R function as the implementation.
wasmer_function_new_i32_to_void(ptr, rfun)wasmer_function_new_i32_to_void(ptr, rfun)
Create a WASM host function with signature i32 -> void
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()
## Not run: wasmer_function_new_i32_to_void(ptr, function(x) cat(x)) ## End(Not run)## Not run: wasmer_function_new_i32_to_void(ptr, function(x) cat(x)) ## End(Not run)
Create a WASM host function that takes no arguments and returns an i32, using an R function as the implementation.
wasmer_function_new_void_to_i32(ptr, rfun)wasmer_function_new_void_to_i32(ptr, rfun)
Create a WASM host function with signature void -> i32
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()
## Not run: wasmer_function_new_void_to_i32(ptr, function() 42) ## End(Not run)## Not run: wasmer_function_new_void_to_i32(ptr, function() 42) ## End(Not run)
Get a pointer to an exported table from a WASM instance by name.
wasmer_get_exported_table_ext(ptr, instance_name, table_export_name)wasmer_get_exported_table_ext(ptr, instance_name, table_export_name)
ptr |
External pointer to WasmerRuntime. |
instance_name |
Name of the instance. |
table_export_name |
Name of the exported table. |
Get a pointer to an exported table from a WASM instance by name
External pointer to Table, or NULL if not found
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()
## Not run: wasmer_get_exported_table_ext(ptr, "inst1", "table1") ## End(Not run)## Not run: wasmer_get_exported_table_ext(ptr, "inst1", "table1") ## End(Not run)
Create a simple WASM "Hello World" example.
wasmer_hello_world_example_ext(ptr)wasmer_hello_world_example_ext(ptr)
ptr |
External pointer to WasmerRuntime. |
Create a simple "Hello World" example
String result from WASM hello function
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()
## Not run: wasmer_hello_world_example_ext(ptr) ## End(Not run)## Not run: wasmer_hello_world_example_ext(ptr) ## End(Not run)
Example with host function imports.
wasmer_host_function_example_ext(ptr)wasmer_host_function_example_ext(ptr)
ptr |
External pointer to WasmerRuntime. |
Example with host function imports
List with results
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()
## Not run: wasmer_host_function_example_ext(ptr) ## End(Not run)## Not run: wasmer_host_function_example_ext(ptr) ## End(Not run)
Instantiate a compiled module in the runtime.
wasmer_instantiate_ext(ptr, module_name, instance_name)wasmer_instantiate_ext(ptr, module_name, instance_name)
ptr |
External pointer to WasmerRuntime |
module_name |
Name of the module to instantiate |
instance_name |
Name to register the instance under |
Status message
Instantiate a WASM module with host functions for mathematical operations.
wasmer_instantiate_with_math_imports_ext(ptr, module_name, instance_name)wasmer_instantiate_with_math_imports_ext(ptr, module_name, instance_name)
ptr |
External pointer to WasmerRuntime. |
module_name |
String name of the module to instantiate. |
instance_name |
String name to identify this instance. |
Create an instance with host functions for mathematical operations
Status message
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()
## Not run: wasmer_instantiate_with_math_imports_ext(ptr, "mod1", "inst1") ## End(Not run)## Not run: wasmer_instantiate_with_math_imports_ext(ptr, "mod1", "inst1") ## End(Not run)
Instantiate a compiled WASM module in the runtime, with a custom table import.
wasmer_instantiate_with_table_ext(ptr, module_name, instance_name, table_ptr)wasmer_instantiate_with_table_ext(ptr, module_name, instance_name, table_ptr)
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". |
Instantiate a compiled module in the runtime, with a custom table import
Status message
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()
## Not run: wasmer_instantiate_with_table_ext(ptr, "mod1", "inst1", table_ptr) ## End(Not run)## Not run: wasmer_instantiate_with_table_ext(ptr, "mod1", "inst1", table_ptr) ## End(Not run)
List all exports from a WASM instance.
wasmer_list_exports_ext(ptr, instance_name)wasmer_list_exports_ext(ptr, instance_name)
ptr |
External pointer to WasmerRuntime. |
instance_name |
Name of the instance. |
List all exports from a WASM instance
List with success flag and exports or error
wasmer_list_function_signatures_ext()
Other exports and signatures:
wasmer_list_function_signatures_ext()
## Not run: wasmer_list_exports_ext(ptr, "inst1") ## End(Not run)## Not run: wasmer_list_exports_ext(ptr, "inst1") ## End(Not run)
List exported function signatures (name, input types, output types) for a WASM instance.
wasmer_list_function_signatures_ext(ptr, instance_name)wasmer_list_function_signatures_ext(ptr, instance_name)
ptr |
External pointer to WasmerRuntime. |
instance_name |
Name of the instance. |
List exported function signatures (name, input types, output types) for a WASM instance
Data frame with columns: name, params, results
Other exports and signatures:
wasmer_list_exports_ext()
## Not run: wasmer_list_function_signatures_ext(ptr, "inst1") ## End(Not run)## Not run: wasmer_list_function_signatures_ext(ptr, "inst1") ## End(Not run)
Example WASM module for math operations.
wasmer_math_example_ext(ptr, a, b)wasmer_math_example_ext(ptr, a, b)
ptr |
External pointer to WasmerRuntime. |
a |
First integer. |
b |
Second integer. |
Math operations example
List with results of add and multiply
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()
## Not run: wasmer_math_example_ext(ptr, 2, 3) ## End(Not run)## Not run: wasmer_math_example_ext(ptr, 2, 3) ## End(Not run)
Grow WASM memory by a number of pages.
wasmer_memory_grow_ext(ptr, instance_name, memory_name, pages)wasmer_memory_grow_ext(ptr, instance_name, memory_name, pages)
ptr |
External pointer to WasmerRuntime. |
instance_name |
Name of the instance. |
memory_name |
Name of the exported memory. |
pages |
Number of pages to grow. |
Grow WASM memory by a number of pages
TRUE if successful
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()
## Not run: wasmer_memory_grow_ext(ptr, "inst1", "memory", 1) ## End(Not run)## Not run: wasmer_memory_grow_ext(ptr, "inst1", "memory", 1) ## End(Not run)
Read bytes from WASM memory.
wasmer_memory_read_ext(ptr, instance_name, memory_name, offset, length)wasmer_memory_read_ext(ptr, instance_name, memory_name, offset, length)
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. |
Read bytes from WASM memory
Raw vector of bytes
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()
## Not run: wasmer_memory_read_ext(ptr, "inst1", "memory", 0, 10) ## End(Not run)## Not run: wasmer_memory_read_ext(ptr, "inst1", "memory", 0, 10) ## End(Not run)
Read UTF-8 string from WASM memory.
wasmer_memory_read_string_ext(ptr, instance_name, memory_name, offset, length)wasmer_memory_read_string_ext(ptr, instance_name, memory_name, offset, length)
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. |
Read UTF-8 string from WASM memory
String
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()
## Not run: wasmer_memory_read_string_ext(ptr, "inst1", "memory", 0, 10) ## End(Not run)## Not run: wasmer_memory_read_string_ext(ptr, "inst1", "memory", 0, 10) ## End(Not run)
Get the size of exported memory (in bytes and pages).
wasmer_memory_size_ext(ptr, instance_name, memory_name)wasmer_memory_size_ext(ptr, instance_name, memory_name)
ptr |
External pointer to WasmerRuntime. |
instance_name |
Name of the instance. |
memory_name |
Name of the exported memory (default "memory"). |
Get the size of exported memory (in bytes and pages)
List with size_bytes and size_pages
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()
## Not run: wasmer_memory_size_ext(ptr, "inst1", "memory") ## End(Not run)## Not run: wasmer_memory_size_ext(ptr, "inst1", "memory") ## End(Not run)
Write bytes to WASM memory.
wasmer_memory_write_ext(ptr, instance_name, memory_name, offset, bytes)wasmer_memory_write_ext(ptr, instance_name, memory_name, offset, bytes)
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. |
Write bytes to WASM memory
TRUE if successful
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()
## Not run: wasmer_memory_write_ext(ptr, "inst1", "memory", 0, as.raw(c(1,2,3))) ## End(Not run)## Not run: wasmer_memory_write_ext(ptr, "inst1", "memory", 0, as.raw(c(1,2,3))) ## End(Not run)
Register an R function for use as a host function in WASM (per-runtime).
wasmer_register_r_function_ext(ptr, name, fun)wasmer_register_r_function_ext(ptr, name, fun)
ptr |
External pointer to WasmerRuntime. |
fun |
R function object. |
_name |
Name to register the function under. |
Register an R function for use as a host function in WASM (per-runtime)
TRUE if successful
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()
## Not run: wasmer_register_r_function_ext(ptr, "myfun", function(x) x) ## End(Not run)## Not run: wasmer_register_r_function_ext(ptr, "myfun", function(x) x) ## End(Not run)
Create a new Wasmer runtime for executing WebAssembly modules.
wasmer_runtime_new()wasmer_runtime_new()
Create a new Wasmer runtime
External pointer to WasmerRuntime
wasmer_runtime_new_with_compiler_ext(), wasmer_runtime_release_ressources()
Other runtime management:
wasmer_runtime_new_with_compiler_ext(),
wasmer_runtime_release_ressources()
## Not run: ptr <- wasmer_runtime_new() ## End(Not run)## Not run: ptr <- wasmer_runtime_new() ## End(Not run)
Create a new Wasmer runtime for executing WebAssembly modules using a specified compiler backend.
wasmer_runtime_new_with_compiler_ext(compiler_name)wasmer_runtime_new_with_compiler_ext(compiler_name)
compiler_name |
Name of the compiler ("cranelift", "singlepass"). |
Create a new Wasmer runtime with a specific compiler
External pointer to WasmerRuntime
wasmer_runtime_new(), wasmer_runtime_release_ressources()
Other runtime management:
wasmer_runtime_new(),
wasmer_runtime_release_ressources()
## Not run: ptr <- wasmer_runtime_new_with_compiler_ext("cranelift") ## End(Not run)## Not run: ptr <- wasmer_runtime_new_with_compiler_ext("cranelift") ## End(Not run)
Explicitly shutdown the runtime, free resources, and clear the R external pointer.
wasmer_runtime_release_ressources(ptr)wasmer_runtime_release_ressources(ptr)
ptr |
External pointer to WasmerRuntime. |
Release resources held by the Wasmer runtime
NULL (invisible)
wasmer_runtime_new(), wasmer_runtime_new_with_compiler_ext()
Other runtime management:
wasmer_runtime_new(),
wasmer_runtime_new_with_compiler_ext()
## Not run: wasmer_runtime_release_ressources(ptr) ## End(Not run)## Not run: wasmer_runtime_release_ressources(ptr) ## End(Not run)
Get a function reference from a WASM Table.
wasmer_table_get_ext(ptr, table_ptr, index)wasmer_table_get_ext(ptr, table_ptr, index)
ptr |
External pointer to WasmerRuntime. |
table_ptr |
External pointer to Table. |
index |
Index to get. |
Get a function reference from a WASM Table
External pointer to Function (or NULL)
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()
## Not run: wasmer_table_get_ext(ptr, table_ptr, 0) ## End(Not run)## Not run: wasmer_table_get_ext(ptr, table_ptr, 0) ## End(Not run)
Grow a WASM Table by a number of elements.
wasmer_table_grow_ext(ptr, table_ptr, delta, func_ptr)wasmer_table_grow_ext(ptr, table_ptr, delta, func_ptr)
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. |
Grow a WASM Table
Previous size
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()
## Not run: wasmer_table_grow_ext(ptr, table_ptr, 1, func_ptr) ## End(Not run)## Not run: wasmer_table_grow_ext(ptr, table_ptr, 1, func_ptr) ## End(Not run)
Create a new WASM Table.
wasmer_table_new_ext(ptr, min, max)wasmer_table_new_ext(ptr, min, max)
ptr |
External pointer to WasmerRuntime. |
min |
Minimum size. |
max |
Maximum size (optional). |
Create a new WASM Table
External pointer to Table
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()
## Not run: wasmer_table_new_ext(ptr, 1, 10) ## End(Not run)## Not run: wasmer_table_new_ext(ptr, 1, 10) ## End(Not run)
Set a function reference in a WASM Table.
wasmer_table_set_ext(ptr, table_ptr, index, func_ptr)wasmer_table_set_ext(ptr, table_ptr, index, func_ptr)
ptr |
External pointer to WasmerRuntime. |
table_ptr |
External pointer to Table. |
index |
Index to set. |
func_ptr |
External pointer to Function. |
Set a function reference in a WASM Table
TRUE if successful
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()
## Not run: wasmer_table_set_ext(ptr, table_ptr, 0, func_ptr) ## End(Not run)## Not run: wasmer_table_set_ext(ptr, table_ptr, 0, func_ptr) ## End(Not run)
Create a WASI or WASIX state for the runtime.
wasmer_wasi_state_new_ext(ptr, module_name, env_type)wasmer_wasi_state_new_ext(ptr, module_name, env_type)
ptr |
External pointer to WasmerRuntime. |
module_name |
Name of the module (for WASI/WASIX args). |
env_type |
Environment type: "wasi" (default) or "wasix". |
Create a WASI or WASIX state for the runtime
TRUE if successful, FALSE otherwise
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()
## Not run: wasmer_wasi_state_new_ext(ptr, "mod1", "wasi") ## End(Not run)## Not run: wasmer_wasi_state_new_ext(ptr, "mod1", "wasi") ## End(Not run)
Convert WebAssembly Text (WAT) to WASM binary and return as R raw vector.
wasmer_wat_to_wasm_ext(wat_code)wasmer_wat_to_wasm_ext(wat_code)
wat_code |
WAT code as a string. |
Convert WAT (WebAssembly Text) to WASM binary and return as R raw vector
WASM binary as R raw vector, or error string if conversion fails
wasmer_compile_wat_ext(), wasmer_compile_wasm_ext()
Other module compilation:
wasmer_compile_wasm_ext(),
wasmer_compile_wat_ext()
## Not run: wasmer_wat_to_wasm_ext(wat_code) ## End(Not run)## Not run: wasmer_wat_to_wasm_ext(wat_code) ## End(Not run)