webassembly-webgl-shaders icon indicating copy to clipboard operation
webassembly-webgl-shaders copied to clipboard

Uncaught TypeError: Module._free is not a function

Open Dragon-S opened this issue 2 years ago • 3 comments

Hello I compiled according to your method. Compile command: emcc -o ./dist/appWASM.js ./dev/cpp/emscripten.cpp -O3 -s ALLOW_MEMORY_GROWTH=1 -s USE_WEBGL2=1 -s FULL_ES3=1 -s WASM=1 -s NO_EXIT_RUNTIME=1 -std=c ++1z -s EXPORTED_RUNTIME_METHODS="['ccall','stringToUTF8']" -s ASSERTIONS=1 -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=0

But when running your demo, the following error is reported: Uncaught TypeError: Module._free is not a function at ccallArrays (wasm-arrays.js:1:975) at HTMLButtonElement. ((index):64:13)

May I ask what is the reason?

Thanks a lot for your reply! 截屏2022-05-28 下午6 28 05

Dragon-S avatar May 28 '22 10:05 Dragon-S

But if I use the appWASM.js and appWASM.wasm files from your demo, no error will be reported.

Dragon-S avatar May 28 '22 10:05 Dragon-S

Hey. It's possible that some things may have changed with the way things are compiled, in WebAssembly. This was (I think) quite early on, and I have moved on to other things since, so I'm unsure I'm afraid. You might need a different compile command now.

DanRuta avatar Jun 06 '22 20:06 DanRuta

Hi DanRuta! Thank you very much for your reply. I added the -s EXPORTED_FUNCTIONS="['_free', '_main']" parameter when compiling. There are no errors when running.

Dragon-S avatar Jun 15 '22 02:06 Dragon-S