From b1770039f4d483cdab2d4d136cd7ffbf12f165b7 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Wed, 28 May 2025 14:32:38 +0200 Subject: Enable WASM64 --- web/callback.js | 9 ++++++++- web/http/index.html | 2 +- web/http/nissyapp.mjs | 14 -------------- web/storage.cpp | 7 +++++-- web/worker.mjs | 7 ++----- 5 files changed, 16 insertions(+), 23 deletions(-) (limited to 'web') diff --git a/web/callback.js b/web/callback.js index 178b8e9..e277cf5 100644 --- a/web/callback.js +++ b/web/callback.js @@ -31,8 +31,15 @@ addCallbackFunction: function(f) { callFunction__deps: [ 'cbfl', 'validateCallbackId' ], callFunction: function(id, arg) { + // This is a workaround related to usign WASM64 + // JavaScript's UTF8ToString expects a pointer argument, which for JS is + // of type "number", but WASM64 is passing a BigInt. See also: + // https://github.com/emscripten-core/emscripten/issues/21541 + // (but I could not make the suggested solution work in this case). + // TODO: check if there is a better workaround. + const non64_arg = Number(arg); if (_validateCallbackId(id)) - _cbfl[id](UTF8ToString(arg)); + _cbfl[id](UTF8ToString(non64_arg)); }, callFunctionInt__deps: [ 'cbfl', 'validateCallbackId' ], diff --git a/web/http/index.html b/web/http/index.html index 0846ea8..47ccc0d 100644 --- a/web/http/index.html +++ b/web/http/index.html @@ -11,7 +11,7 @@