Stream: git-wasmtime

Topic: wasmtime / issue #3445 Running .cwasm files without CLI


view this post on Zulip Wasmtime GitHub notifications bot (Oct 12 2021 at 11:37):

Kroeg93 opened issue #3445:

Hi there,

is there any possibility to run .cwasm files in a rust embedding?

Currently i'm storing a .wat file within a buffer and use it as input for Engine::precompile_module

    let buffer = fs::read("./wasm/add.wat")?;
    let precompiled_file = engine.precompile_module(&buffer)?;

Afterwards the buffer is stored to a .cwasm file.

fn save_precompiled_file(buffer: &[u8]) -> std::io::Result<()> {
    let mut precompiled_module = File::create("add.cwasm")?;
    precompiled_module.write_all(&buffer)?;
    Ok(())
}

Is there any function to load the module from the .cwasm file? Or does this work differently?

Thanks :-)


Last updated: Nov 22 2024 at 17:03 UTC