HEAPU8 not found

15 views
Skip to first unread message

lxp...@gmail.com

unread,
May 25, 2024, 5:08:14 AMMay 25
to emscripten-discuss
Hi,

I have a piece of code that used to work until 3.1.54 but fails with 3.1.56. It is

var dataArray = new Uint8Array(data);
var dataSize = dataArray.length * dataArray.BYTES_PER_ELEMENT;
var dataPtr = this.VerovioModule._malloc(dataSize);
this.VerovioModule.HEAPU8.set(dataArray, dataPtr);
var res = this.proxy.loadZipDataBuffer(this.ptr, dataPtr, dataSize);
this.VerovioModule._free(dataPtr);

It crashes with
TypeError: this.VerovioModule.HEAPU8 is undefined

Any ideas?

It is compiled with:

-s WASM=1 
-s INITIAL_MEMORY=512MB 
-s STACK_SIZE=256MB -
s SINGLE_FILE=1 
-s INCOMING_MODULE_JS_API=onRuntimeInitialized 
-O3 
-DNDEBUG 
-std=c++20 
-s STRICT=1 -
-embed-file data/ 
-s EXPORTED_FUNCTIONS="[''_malloc','_free']" 
-s EXPORTED_RUNTIME_METHODS='["cwrap"]'

lxp...@gmail.com

unread,
May 25, 2024, 5:31:03 AMMay 25
to emscripten-discuss
(I found the issue. HEAPU8 had to be added to the runtime https://github.com/emscripten-core/emscripten/pull/21439)
Reply all
Reply to author
Forward
0 new messages