Enable LLVM based wasm backend
I added the same changes as in !1385 (closed).
I tried the same steps given in this comment in the same MR. I am currently facing/stuck-at this error:
LinkError: WebAssembly.instantiate(): Import #0 module="wasi_snapshot_preview1" function="clock_time_get" error: function import requires a callable
The node.js
that I use to test the final wasm_cosh.wasm
is as follows:
const fs = require('fs');
let imports = {};
// let memory = null;
// let exports = null;
let wasmBuffer = fs.readFileSync('./wasm_cosh.wasm');
// imports['memory'] = new WebAssembly['Memory']( {'initial':32} );
// memory = new Uint8Array( imports['memory']['buffer'] );
WebAssembly.instantiate(wasmBuffer, {env: imports, wasi_snapshot_preview1: exports}).then(wasmModule => {
// Exported function live under instance.exports
// const myadd = wasmModule.instance.exports.myadd;
// console.log(add(4, 5));
// console.log(myadd(4, 5));
// const add = wasmModule.instance.exports.add;
// console.log(add(5, 4))
console.log("Success!")
});
Edited by Ubaid Shaikh