OCCT icon indicating copy to clipboard operation
OCCT copied to clipboard

WebGL Viewer Sample: Emscripten no longer exports malloc

Open siquus opened this issue 8 months ago • 0 comments

Description

Dear Open-Cascade Team,

Emscripten used to "accidentally" export malloc but no longer does (Emscripten changelog). As a consequence, when using a recent Emscripten version, the WebGL Viewer Sample's "Choose BREP file to upload" will fail to load a new brep file with the error "Uncaught TypeError: Module._malloc is not a function".

To fix this issue, add the following line to the CMakeLists.txt of that sample (ref. Emscripten docu):

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s EXPORTED_FUNCTIONS=\"['_main', '_malloc']\"")

Thanks, Patrik

Expected Behavior

BREP file is loaded into the viewer.

Actual Behavior

An error is thrown and the BREP file is not loaded.

Sample Code or DRAW Tcl Script

NA

Operating System

Linux

Compiler

GCC

Bitness

64-bit

OCCT Version

latest

Additional Files

No response

siquus avatar Mar 16 '25 07:03 siquus