Closed1
js-string-builtins
(module
(import "wasm:js-string" "fromCharCodeArray" (func $fromCharCodeArray (param (ref null $char-array)) (param i32) (param i32) (result (ref extern))))
(type $char-array (array (mut i16)))
(func (export "test")
(result (ref extern))
(call $fromCharCodeArray
(array.new_fixed $char-array 3
(i32.const 97)
(i32.const 98)
(i32.const 99)
)
(i32.const 0)
(i32.const 3)
)
)
)
import { readFileSync } from "node:fs";
const wasmBuffer = readFileSync("hello.wasm");
const importObj = {}
const wasmModule = await WebAssembly.instantiate(wasmBuffer, importObj, { builtins: ['js-string'] });
const { test } = wasmModule.instance.exports;
const o = test();
console.log(o);
$ wasm-as --version
wasm-as version 117
$ node -v
v22.3.0
$ wasm-as -all hello.wat
$ node --experimental-wasm-imported-strings hello.mjs
abc
このスクラップは5ヶ月前にクローズされました