Module wasmer_c_api::wasm_c_api::wat

source ·
Expand description

Wasmer-specific API to transform the WAT format into Wasm bytes.

It is used mostly for testing or for small program purposes.

§Example

int main() {
    // Our WAT module.
    wasm_byte_vec_t wat;
    wasm_byte_vec_new(&wat, 8, "(module)");

    // Our Wasm bytes.
    wasm_byte_vec_t wasm;
    wat2wasm(&wat, &wasm);

    // It works!
    assert(wasm.size > 0);

    // Free everything.
    wasm_byte_vec_delete(&wasm);
    wasm_byte_vec_delete(&wat);

    return 0;
}

Functions§

  • Parses in-memory bytes as either the WAT format, or a binary Wasm module. This is wasmer-specific.