Skip to content

Commit f8492fc

Browse files
committed
Fix Memory: Use exported memory
1 parent e559818 commit f8492fc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

components/LoadLFortran.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,10 @@ async function setup_lfortran_funcs(lfortran_funcs, myPrint) {
158158
lfortran_funcs.execute_code = async function (bytes, stdout_print) {
159159
var exit_code = {val: 1}; /* non-zero exit code */
160160
var outputBuffer = [];
161-
var memory = new WebAssembly.Memory({ initial: 100, maximum: 100 }); // fixed 6.4 Mb memory currently
161+
const wasm = await WebAssembly.compile(bytes);
162+
var memory = wasm.exports.memory;
162163
var imports = define_imports(memory, outputBuffer, exit_code, stdout_print);
163-
var err_msg = await run_wasm(bytes, imports);
164+
var err_msg = await run_wasm(wasm, imports);
164165
stdout_print(outputBuffer.join(""));
165166
if (exit_code.val == 0) {
166167
return;

0 commit comments

Comments
 (0)