Sign in

    wasmtime

    Wasmtime C API bindings for MoonBit (native target)

    wasmtime
    wasm
    ffi
    native
    Download zip
    Author
    Version
    0.1.6
    License
    Apache-2.0
    Last updated
    5 months ago
    Downloads
    59

    Dependencies

    #mizchi/wasmtime.mbt

    MoonBit bindings to the Wasmtime C API (native target). This repo starts with a minimal bridge that verifies native linking and exposes version() plus basic engine lifecycle.

    #Status

    • native target only
    • requires Wasmtime C API headers and library at build time

    #Build Requirements

    This repo vendors Wasmtime as a git submodule and builds the C API via a MoonBit pre-build hook. You need a Rust toolchain (cargo) available.

    The build hook:

    • initializes deps/wasmtime (git submodule)
    • runs cargo build -p wasmtime-c-api --release

    When deps/wasmtime is missing (e.g. installed via .mooncakes), the build script will clone Wasmtime from GitHub and checkout the pinned commit in deps/wasmtime.rev before building. Git is required in that case.

    The link flags are set in src/moon.pkg:

    cc-link-flags: -Ldeps/wasmtime/target/release -lwasmtime

    The pre-build step also generates src/wasmtime_version.h from deps/wasmtime/crates/c-api/include/wasmtime.h so the MoonBit API can expose the Wasmtime version without depending on the full C headers during compile.

    #Using as a dependency (.mooncakes)

    When this module is installed as a dependency under .mooncakes/mizchi/wasmtime, the pre-build hook in this repo is not executed automatically. If you need Wasmtime built from a consumer module, add a pre-build step there to call the script inside .mooncakes.

    Example moon.pkg in the consumer:

    import { "mizchi/wasmtime", } options( "pre-build": [ { "input": [ ".mooncakes/mizchi/wasmtime/src/scripts/build-wasmtime.sh" ], "output": [ "build-stamps/wasmtime_prebuild.stamp" ], "command": "mkdir -p build-stamps && bash .mooncakes/mizchi/wasmtime/src/scripts/build-wasmtime.sh src/build-stamps/wasmtime_build.stamp && date -u +%Y-%m-%dT%H:%M:%SZ > $output" } ], )

    The build script writes a log at src/build-stamps/wasmtime_build.stamp so you can confirm the cwd and resolved paths.

    #Quick Commands

    just # check + test (native target) just fmt # format code just check # type check just test # run tests just run # run main just info # generate type definition files just prebuild-log # show pre-build log

    Note: just test uses --release to avoid crashes in debug builds when linking against the Wasmtime C API.

    #Example

    fn main {
    println(@wasmtime.version())
    }

    #Async Result Example (native)

    let (engine, store, context) = @wasmtime.async_context_new(4 * 1024 * 1024)
    let args = @wasmtime.make_val_buffer(0)
    let results = @wasmtime.make_val_buffer(0)
    let trap_ptr = @wasmtime.make_ptr_buffer()
    let err_ptr = @wasmtime.make_ptr_buffer()

    let params : Bytes = []
    let results_sig : Bytes = []
    let ty = @wasmtime.functype_new_from_valkinds_or_raise(params, results_sig)
    let cb_ptr = @wasmtime.func_noop_callback_ptr()
    let func_bytes = @wasmtime.func_buffer_new_with_ptr(context, ty, cb_ptr, 0, 0)

    let future_result =
    @wasmtime.func_call_async_result_autoclean(context, func_bytes, args, results, trap_ptr, err_ptr)
    match future_result {
    Ok(future) => {
    while not(@wasmtime.call_future_poll(future)) { () }
    @wasmtime.call_future_delete(future)
    }
    Err(_err) => {
    // trap/error pointers are already deleted
    }
    }
    // Error example: "func_call_async failed (error=true, trap=false)"
    @wasmtime.functype_delete(ty)
    @wasmtime.async_context_delete(engine, store)

    OptLevel

    type OptLevel = Int

    Optimization level identifiers (see wasmtime_config_cranelift_opt_level_set).

    ProfilingStrategy

    type ProfilingStrategy = Int

    Profiling strategy identifiers (see wasmtime_config_profiler_set).

    Strategy

    type Strategy = Int

    Strategy identifiers (see wasmtime_config_strategy_set).

    ValKind

    type ValKind = Int

    WebAssembly value kind identifiers (see wasm_valtype_new).

    CallFuture

    #external
    pub type CallFuture

    Opaque Wasmtime call future type from the C API.

    Config

    #external
    pub type Config

    Opaque WebAssembly config type from the C API.

    Context

    #external
    pub type Context

    Opaque Wasmtime context type from the C API.

    Engine

    #external
    pub type Engine

    Opaque WebAssembly engine type from the C API.

    FuncType

    #external
    pub type FuncType

    Opaque WebAssembly function type from the C API.

    InstancePre

    #external
    pub type InstancePre

    Opaque Wasmtime instance-pre type from the C API.

    Linker

    #external
    pub type Linker

    Opaque Wasmtime linker type from the C API.

    Module

    #external
    pub type Module

    Opaque Wasmtime module type from the C API.

    Store

    #external
    pub type Store

    Opaque WebAssembly store type from the C API.

    Trap

    #external
    pub type Trap

    Opaque WebAssembly trap type from the C API.

    WasmtimeError

    #external
    pub type WasmtimeError

    Opaque Wasmtime error type from the C API.

    WasmtimeStore

    #external
    pub type WasmtimeStore

    Opaque Wasmtime store type from the C API.

    OPT_LEVEL_NONE

    let OPT_LEVEL_NONE : Int

    No optimizations.

    OPT_LEVEL_SPEED

    let OPT_LEVEL_SPEED : Int

    Optimize for speed.

    OPT_LEVEL_SPEED_AND_SIZE

    let OPT_LEVEL_SPEED_AND_SIZE : Int

    Optimize for speed and size.

    PROFILING_STRATEGY_JITDUMP

    let PROFILING_STRATEGY_JITDUMP : Int

    Linux perf jitdump.

    PROFILING_STRATEGY_NONE

    let PROFILING_STRATEGY_NONE : Int

    No profiling.

    PROFILING_STRATEGY_PERFMAP

    let PROFILING_STRATEGY_PERFMAP : Int

    Linux perfmap.

    PROFILING_STRATEGY_VTUNE

    let PROFILING_STRATEGY_VTUNE : Int

    Intel VTune profiling.

    STRATEGY_AUTO

    let STRATEGY_AUTO : Int

    Auto-select compilation strategy.

    STRATEGY_CRANELIFT

    let STRATEGY_CRANELIFT : Int

    Force Cranelift compilation.

    VALKIND_EXTERNREF

    let VALKIND_EXTERNREF : Int

    wasm externref value kind.

    VALKIND_F32

    let VALKIND_F32 : Int

    wasm f32 value kind.

    VALKIND_F64

    let VALKIND_F64 : Int

    wasm f64 value kind.

    VALKIND_FUNCREF

    let VALKIND_FUNCREF : Int

    wasm funcref value kind.

    VALKIND_I32

    let VALKIND_I32 : Int

    wasm i32 value kind.

    VALKIND_I64

    let VALKIND_I64 : Int

    wasm i64 value kind.

    async_context_delete

    fn async_context_delete(engine : Engine, store : WasmtimeStore) -> Unit

    Delete async engine/store pair.

    async_context_new

    fn async_context_new(async_stack_size : UInt64) -> (Engine, WasmtimeStore, Context)

    Create engine/store/context for async execution.

    call_future_delete

    fn call_future_delete(future : CallFuture) -> Unit

    Delete an async call future.

    call_future_poll

    fn call_future_poll(future : CallFuture) -> Bool

    Poll an async call future. Returns true if completed.

    clock_now_ns

    fn clock_now_ns() -> UInt64

    Current monotonic time in nanoseconds.

    config_async_stack_size_set

    fn config_async_stack_size_set(config : Config, bytes : UInt64) -> Unit

    Configure async stack size in bytes.

    config_cache_config_load

    fn config_cache_config_load(config : Config, path : String) -> WasmtimeError

    Load a cache config. Returns null on success.

    config_cache_config_load_bytes

    fn config_cache_config_load_bytes(config : Config, bytes : Bytes, len : Int) -> WasmtimeError

    Configure cache from UTF-8 bytes (empty => default).

    config_cache_config_load_default

    fn config_cache_config_load_default(config : Config) -> WasmtimeError

    Load the default cache config (pass NULL path). Returns null on success.

    config_consume_fuel_set

    fn config_consume_fuel_set(config : Config, enable : Bool) -> Unit

    Enable/disable fuel consumption.

    config_cranelift_debug_verifier_set

    fn config_cranelift_debug_verifier_set(config : Config, enable : Bool) -> Unit

    Enable/disable Cranelift debug verifier.

    config_cranelift_flag_enable

    fn config_cranelift_flag_enable(config : Config, flag : String) -> Unit

    Enable a Cranelift flag by name.

    config_cranelift_flag_enable_bytes

    fn config_cranelift_flag_enable_bytes(config : Config, bytes : Bytes, len : Int) -> Unit

    Enable a Cranelift flag from UTF-8 bytes.

    config_cranelift_flag_set

    fn config_cranelift_flag_set(config : Config, key : String, value : String) -> Unit

    Set a Cranelift flag by name to a value.

    config_cranelift_flag_set_bytes

    fn config_cranelift_flag_set_bytes(config : Config, key : Bytes, key_len : Int, value : Bytes, value_len : Int) -> Unit

    Set a Cranelift flag from UTF-8 bytes.

    config_cranelift_nan_canonicalization_set

    fn config_cranelift_nan_canonicalization_set(config : Config, enable : Bool) -> Unit

    Enable/disable Cranelift NaN canonicalization.

    config_cranelift_opt_level_set

    fn config_cranelift_opt_level_set(config : Config, level : Int) -> Unit

    Set Cranelift optimization level.

    config_debug_info_set

    fn config_debug_info_set(config : Config, enable : Bool) -> Unit

    Enable/disable DWARF debug info.

    config_delete

    fn config_delete(config : Config) -> Unit

    Destroy a configuration created by config_new.

    config_epoch_interruption_set

    fn config_epoch_interruption_set(config : Config, enable : Bool) -> Unit

    Enable/disable epoch interruption.

    config_host_stack_creator_set_bytes

    fn config_host_stack_creator_set_bytes(config : Config, creator : Bytes) -> Unit

    Configure a custom stack creator from raw bytes.

    config_macos_use_mach_ports_set

    fn config_macos_use_mach_ports_set(config : Config, enable : Bool) -> Unit

    Enable/disable Mach ports for traps on macOS.

    config_max_wasm_stack_set

    fn config_max_wasm_stack_set(config : Config, bytes : UInt64) -> Unit

    Configure max wasm stack size in bytes.

    config_memory_guard_size_set

    fn config_memory_guard_size_set(config : Config, bytes : UInt64) -> Unit

    Configure memory guard size.

    config_memory_may_move_set

    fn config_memory_may_move_set(config : Config, enable : Bool) -> Unit

    Configure memory movement semantics.

    config_memory_reservation_for_growth_set

    fn config_memory_reservation_for_growth_set(config : Config, bytes : UInt64) -> Unit

    Configure memory reservation for growth size.

    config_memory_reservation_set

    fn config_memory_reservation_set(config : Config, bytes : UInt64) -> Unit

    Configure initial memory reservation size.

    config_native_unwind_info_set

    fn config_native_unwind_info_set(config : Config, enable : Bool) -> Unit

    Enable/disable native unwind info.

    config_new

    fn config_new() -> Config

    Create a new configuration.

    config_parallel_compilation_set

    fn config_parallel_compilation_set(config : Config, enable : Bool) -> Unit

    Enable/disable parallel compilation.

    config_profiler_set

    fn config_profiler_set(config : Config, strategy : Int) -> Unit

    Configure profiling strategy.

    config_shared_memory_set

    fn config_shared_memory_set(config : Config, enable : Bool) -> Unit

    Enable/disable shared memories.

    config_signals_based_traps_set

    fn config_signals_based_traps_set(config : Config, enable : Bool) -> Unit

    Enable/disable signals-based traps.

    config_strategy_set

    fn config_strategy_set(config : Config, strategy : Int) -> Unit

    Set compilation strategy.

    config_target_set

    fn config_target_set(config : Config, target : String) -> WasmtimeError

    Set the target triple for a config. Returns null on success.

    config_target_set_bytes

    fn config_target_set_bytes(config : Config, bytes : Bytes, len : Int) -> WasmtimeError

    Configure the target triple from UTF-8 bytes.

    config_wasm_bulk_memory_set

    fn config_wasm_bulk_memory_set(config : Config, enable : Bool) -> Unit

    Enable/disable bulk memory.

    config_wasm_custom_page_sizes_set

    fn config_wasm_custom_page_sizes_set(config : Config, enable : Bool) -> Unit

    Enable/disable custom page sizes.

    config_wasm_exceptions_set

    fn config_wasm_exceptions_set(config : Config, enable : Bool) -> Unit

    Enable/disable exceptions.

    config_wasm_function_references_set

    fn config_wasm_function_references_set(config : Config, enable : Bool) -> Unit

    Enable/disable function references.

    config_wasm_gc_set

    fn config_wasm_gc_set(config : Config, enable : Bool) -> Unit

    Enable/disable GC proposal.

    config_wasm_memory64_set

    fn config_wasm_memory64_set(config : Config, enable : Bool) -> Unit

    Enable/disable memory64.

    config_wasm_multi_memory_set

    fn config_wasm_multi_memory_set(config : Config, enable : Bool) -> Unit

    Enable/disable multi memory.

    config_wasm_multi_value_set

    fn config_wasm_multi_value_set(config : Config, enable : Bool) -> Unit

    Enable/disable multi value.

    config_wasm_reference_types_set

    fn config_wasm_reference_types_set(config : Config, enable : Bool) -> Unit

    Enable/disable reference types.

    config_wasm_relaxed_simd_deterministic_set

    fn config_wasm_relaxed_simd_deterministic_set(config : Config, enable : Bool) -> Unit

    Enable/disable deterministic relaxed SIMD.

    config_wasm_relaxed_simd_set

    fn config_wasm_relaxed_simd_set(config : Config, enable : Bool) -> Unit

    Enable/disable relaxed SIMD.

    config_wasm_simd_set

    fn config_wasm_simd_set(config : Config, enable : Bool) -> Unit

    Enable/disable SIMD.

    config_wasm_stack_switching_set

    fn config_wasm_stack_switching_set(config : Config, enable : Bool) -> Unit

    Enable/disable stack switching.

    config_wasm_tail_call_set

    fn config_wasm_tail_call_set(config : Config, enable : Bool) -> Unit

    Enable/disable tail calls.

    config_wasm_threads_set

    fn config_wasm_threads_set(config : Config, enable : Bool) -> Unit

    Enable/disable wasm threads.

    config_wasm_wide_arithmetic_set

    fn config_wasm_wide_arithmetic_set(config : Config, enable : Bool) -> Unit

    Enable/disable wide arithmetic.

    context_epoch_deadline_async_yield_and_update

    fn context_epoch_deadline_async_yield_and_update(context : Context, delta : UInt64) -> WasmtimeError

    Configure async epoch deadline yield and update for a context.

    context_fuel_async_yield_interval

    fn context_fuel_async_yield_interval(context : Context, interval : UInt64) -> WasmtimeError

    Configure async fuel yield interval for a context.

    engine_delete

    fn engine_delete(engine : Engine) -> Unit

    Destroy an engine created by engine_new.

    engine_new

    fn engine_new() -> Engine

    Create a new WebAssembly engine.

    engine_new_with_config

    fn engine_new_with_config(config : Config) -> Engine

    Create a new engine with a configuration.

    error_delete

    fn error_delete(error : WasmtimeError) -> Unit

    Delete a Wasmtime error.

    error_delete_ptr

    fn error_delete_ptr(bytes : Bytes) -> Unit

    Delete a Wasmtime error pointer stored in bytes.

    error_delete_ptr_buffer

    fn error_delete_ptr_buffer(ptr_buf : Bytes) -> Unit

    Delete a Wasmtime error pointer stored in bytes if not null.

    error_is_null

    fn error_is_null(error : WasmtimeError) -> Bool

    Check if a pointer-like error is null.

    func_buffer_new_with_ptr

    fn func_buffer_new_with_ptr(context : Context, ty : FuncType, cb_ptr : UInt64, data_ptr : UInt64, finalizer_ptr : UInt64) -> Bytes

    Create a host function into a bytes buffer using raw callback pointers.

    func_call_async

    fn func_call_async(context : Context, func_bytes : Bytes, args : Bytes, results : Bytes, trap_ptr : Bytes, err_ptr : Bytes) -> CallFuture raise

    Call a function asynchronously with buffer-derived counts.

    func_call_async_bytes

    fn func_call_async_bytes(context : Context, func : Bytes, args : Bytes, nargs : Int, results : Bytes, nresults : Int, trap_out : Bytes, error_out : Bytes) -> CallFuture

    Call a function asynchronously using bytes-backed values.

    func_call_async_result

    fn func_call_async_result(context : Context, func_bytes : Bytes, args : Bytes, results : Bytes, trap_ptr : Bytes, err_ptr : Bytes) -> Result[CallFuture, Error]

    Call a function asynchronously and return a Result.

    func_call_async_result_autoclean

    fn func_call_async_result_autoclean(context : Context, func_bytes : Bytes, args : Bytes, results : Bytes, trap_ptr : Bytes, err_ptr : Bytes) -> Result[CallFuture, Error]

    Call a function asynchronously, auto-cleaning trap/error pointers on failure.

    func_new_ptr_bytes

    fn func_new_ptr_bytes(context : Context, ty : FuncType, cb_ptr : UInt64, data_ptr : UInt64, finalizer_ptr : UInt64, func_out : Bytes) -> Unit

    Create a host function using raw callback pointers and write into bytes.

    func_noop_callback_ptr

    fn func_noop_callback_ptr() -> UInt64

    Get a pointer to a no-op host callback.

    func_sizeof

    fn func_sizeof() -> Int

    Size of wasmtime_func_t in bytes.

    functype_delete

    fn functype_delete(ty : FuncType) -> Unit

    Delete a function type.

    functype_is_null

    fn functype_is_null(ty : FuncType) -> Bool

    Check if a functype pointer is null.

    functype_new_from_kinds

    fn functype_new_from_kinds(params : Bytes, nparams : Int, results : Bytes, nresults : Int) -> FuncType

    Create a function type from value kind byte arrays.

    functype_new_from_valkinds

    fn functype_new_from_valkinds(params : Bytes, results : Bytes) -> FuncType

    Create a function type from value kind arrays.

    functype_new_from_valkinds_or_raise

    fn functype_new_from_valkinds_or_raise(params : Bytes, results : Bytes) -> FuncType raise

    Create a function type or raise on failure.

    functype_new_from_valkinds_result

    fn functype_new_from_valkinds_result(params : Bytes, results : Bytes) -> Result[FuncType, Error]

    Create a function type and return a Result.

    instance_pre_instantiate_async_bytes

    fn instance_pre_instantiate_async_bytes(instance_pre : InstancePre, context : Context, instance_out : Bytes, trap_out : Bytes, error_out : Bytes) -> CallFuture

    Instantiate a pre-initialized instance asynchronously.

    instance_sizeof

    fn instance_sizeof() -> Int

    Size of wasmtime_instance_t in bytes.

    linker_define_async_func_ptr

    fn linker_define_async_func_ptr(linker : Linker, module_bytes : Bytes, module_len : Int, name : Bytes, name_len : Int, ty : FuncType, cb_ptr : UInt64, data_ptr : UInt64, finalizer_ptr : UInt64) -> WasmtimeError

    Define an async host function using raw callback pointers.

    linker_instantiate_async_bytes

    fn linker_instantiate_async_bytes(linker : Linker, context : Context, module_val : Module, instance_out : Bytes, trap_out : Bytes, error_out : Bytes) -> CallFuture

    Instantiate a module asynchronously and write the instance into bytes.

    make_func_buffer

    fn make_func_buffer() -> Bytes

    Allocate a buffer for wasmtime_func_t.

    make_instance_buffer

    fn make_instance_buffer() -> Bytes

    Allocate a buffer for wasmtime_instance_t.

    make_ptr_buffer

    fn make_ptr_buffer() -> Bytes

    Allocate a bytes buffer sized to hold one native pointer.

    make_stack_creator_buffer

    fn make_stack_creator_buffer() -> Bytes

    Allocate a buffer for wasmtime_stack_creator_t.

    make_val_buffer

    fn make_val_buffer(n : Int) -> Bytes

    Allocate a buffer for n wasmtime_val_t values.

    noop_callback_ptr

    fn noop_callback_ptr() -> UInt64

    Get a pointer to a no-op host function callback.

    ptr_buffer_clear

    fn ptr_buffer_clear(ptr_buf : Bytes) -> Unit

    Clear a pointer buffer to null.

    ptr_buffer_is_null

    fn ptr_buffer_is_null(ptr_buf : Bytes) -> Bool

    Returns true when the pointer stored in the buffer is null.

    ptr_buffer_read_u64

    fn ptr_buffer_read_u64(ptr_buf : Bytes) -> UInt64

    Read a pointer value as UInt64 from a bytes buffer.

    ptr_clear

    fn ptr_clear(bytes : Bytes) -> Unit

    Clear a pointer stored in bytes.

    ptr_is_null

    fn ptr_is_null(bytes : Bytes) -> Bool

    Check whether a pointer stored in bytes is null.

    ptr_read_u64

    fn ptr_read_u64(bytes : Bytes) -> UInt64

    Read a pointer value as UInt64 from bytes.

    ptr_sizeof

    fn ptr_sizeof() -> Int

    Size of a pointer in bytes.

    stack_creator_sizeof

    fn stack_creator_sizeof() -> Int

    Size of wasmtime_stack_creator_t in bytes.

    store_delete

    fn store_delete(store : Store) -> Unit

    Destroy a store created by store_new.

    store_new

    fn store_new(engine : Engine) -> Store

    Create a new store associated with the given engine.

    trap_delete_ptr

    fn trap_delete_ptr(bytes : Bytes) -> Unit

    Delete a trap pointer stored in bytes.

    trap_delete_ptr_buffer

    fn trap_delete_ptr_buffer(ptr_buf : Bytes) -> Unit

    Delete a trap pointer stored in bytes if not null.

    val_buffer_count

    fn val_buffer_count(buf : Bytes) -> Int

    Compute the number of values in a buffer.

    val_buffer_count_or_raise

    fn val_buffer_count_or_raise(buf : Bytes) -> Int raise

    Validate a val buffer and return the count or raise.

    val_buffer_count_result

    fn val_buffer_count_result(buf : Bytes) -> Result[Int, Error]

    Validate a val buffer and return the count or an error.

    val_buffer_get_f32

    fn val_buffer_get_f32(buf : Bytes, index : Int) -> Float

    Get f32 value at index in a val buffer.

    val_buffer_get_f64

    fn val_buffer_get_f64(buf : Bytes, index : Int) -> Double

    Get f64 value at index in a val buffer.

    val_buffer_get_i32

    fn val_buffer_get_i32(buf : Bytes, index : Int) -> Int

    Get i32 value at index in a val buffer.

    val_buffer_get_i64

    fn val_buffer_get_i64(buf : Bytes, index : Int) -> Int64

    Get i64 value at index in a val buffer.

    val_buffer_set_f32

    fn val_buffer_set_f32(buf : Bytes, index : Int, value : Float) -> Unit

    Set f32 value at index in a val buffer.

    val_buffer_set_f64

    fn val_buffer_set_f64(buf : Bytes, index : Int, value : Double) -> Unit

    Set f64 value at index in a val buffer.

    val_buffer_set_i32

    fn val_buffer_set_i32(buf : Bytes, index : Int, value : Int) -> Unit

    Set i32 value at index in a val buffer.

    val_buffer_set_i64

    fn val_buffer_set_i64(buf : Bytes, index : Int, value : Int64) -> Unit

    Set i64 value at index in a val buffer.

    val_buffer_unroot_at

    fn val_buffer_unroot_at(buf : Bytes, index : Int) -> Unit

    Unroot a value at index in a val buffer.

    val_get_f32_at

    fn val_get_f32_at(vals : Bytes, index : Int) -> Float

    Get an f32 value at index.

    val_get_f64_at

    fn val_get_f64_at(vals : Bytes, index : Int) -> Double

    Get an f64 value at index.

    val_get_i32_at

    fn val_get_i32_at(vals : Bytes, index : Int) -> Int

    Get an i32 value at index.

    val_get_i64_at

    fn val_get_i64_at(vals : Bytes, index : Int) -> Int64

    Get an i64 value at index.

    val_kind_at

    fn val_kind_at(vals : Bytes, index : Int) -> Int

    Read a wasmtime_val_t kind at index.

    val_set_f32_at

    fn val_set_f32_at(vals : Bytes, index : Int, value : Float) -> Unit

    Set an f32 value at index.

    val_set_f64_at

    fn val_set_f64_at(vals : Bytes, index : Int, value : Double) -> Unit

    Set an f64 value at index.

    val_set_i32_at

    fn val_set_i32_at(vals : Bytes, index : Int, value : Int) -> Unit

    Set an i32 value at index.

    val_set_i64_at

    fn val_set_i64_at(vals : Bytes, index : Int, value : Int64) -> Unit

    Set an i64 value at index.

    val_sizeof

    fn val_sizeof() -> Int

    Size of wasmtime_val_t in bytes.

    val_unroot_at

    fn val_unroot_at(vals : Bytes, index : Int) -> Unit

    Unroot a value at index (for externref/anyref).

    version

    fn version() -> String

    Return the Wasmtime version string reported by the native library.

    wasmtime_store_context

    fn wasmtime_store_context(store : WasmtimeStore) -> Context

    Get the Wasmtime context for a store.

    wasmtime_store_delete

    fn wasmtime_store_delete(store : WasmtimeStore) -> Unit

    Destroy a Wasmtime store.

    wasmtime_store_new

    fn wasmtime_store_new(engine : Engine) -> WasmtimeStore

    Create a new Wasmtime store (no data/finalizer).

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io