EMULATE_FUNCTION_POINTER_CASTS and max-func-params

3 views
Skip to first unread message

John Dallman

unread,
May 17, 2026, 9:28:00 AM (18 hours ago) May 17
to emscripte...@googlegroups.com
The codebase I'm porting to WebAssembly is mostly C, rather than C++, and parts of it are decades old. I'm having to clean up places where it gets clever with function calling, to get rid of function signature mismatches.

Today I'm trying -sEMULATE_FUNCTION_POINTER_CASTS=1, which produces this error: 

Fatal: max-func-params needs to be at least 26Fatal: max-func-params needs to be at least 26
em++: error: '/sdl/prairie/tools/kernel_tools/webasm/emscripten/v4.0.21/emsdk/upstream/bin/wasm-opt --fpcast-emu /u/jgd/regimes/webasm_vdevel/kid.wasm -o /u/jgd/regimes/webasm_vdevel/kid.wasm -g --mvp-features --enable-threads --enable-bulk-memory --enable-bulk-memory-opt --enable-call-indirect-overlong --enable-multivalue --enable-mutable-globals --enable-nontrapping-float-to-int --enable-reference-types --enable-sign-ext' failed (returned 1)
Warning: Error building /u/jgd/regimes/webasm_vdevel/kid.js

It appears wasm-opt needs to be given a bigger value for "max-func-params" Binaryen appears to be the same software as wasm-opt, but confirmation of that would be good. 

I tried --max-func-params=30, and that gave me:  

Fatal: max-func-params needs to be at least 17
em++: error: '/sdl/prairie/tools/kernel_tools/webasm/emscripten/v4.0.21/emsdk/upstream/bin/wasm-opt --fpcast-emu /u/jgd/regimes/webasm_vdevel/kid.wasm -o /u/jgd/regimes/webasm_vdevel/kid.wasm -g --mvp-features --enable-threads --enable-bulk-memory --enable-bulk-memory-opt --enable-call-indirect-overlong --enable-multivalue --enable-mutable-globals --enable-nontrapping-float-to-int --enable-reference-types --enable-sign-ext' failed (returned 1)
Warning: Error building /u/jgd/regimes/webasm_vdevel/kid.js

Yes, that is what I'm seeing. Specifying 30 parameters produces an error asking for a lower minimum. The manpage I found for wasm-opt at Debian doesn't have an option for setting the maximum number of parameters that I can see. https://manpages.debian.org/experimental/binaryen/wasm-opt.1.en.html 

How do I set a higher maximum number of parameters?

My full command line is:

em++ -pthread -Wcast-function-type --pre-js /Parasolid/lx86/tools/patssy/com/kid_node_prerun.js -sMAXIMUM_MEMORY=4000MB -sEXPORTED_FUNCTIONS=ENV,_main -sALLOW_MEMORY_GROWTH -sSTACK_SIZE=4096KB -sNODERAWFS -sEXIT_RUNTIME=1 -sENVIRONMENT=node --emit-symbol-map -sSTRICT=1 -sINCOMING_MODULE_JS_API=preRun -pthread -sSUPPORT_LONGJMP=1 -sDEFAULT_PTHREAD_STACK_SIZE=1MB -sEMULATE_FUNCTION_POINTER_CASTS=1 --max-func-params=30 -sASSERTIONS=1 -sSAFE_HEAP=0 /Parasolid/lx86/vdevel_webasm/lsp/kernel.o clu/clu_gra_structure.o gra/gra_structure.o lop/lop_deform_operations.o vol/vol_offset.o /shamrock/sw_tools/lib/webasm/aga_fix.o /Parasolid/lx86/vdevel_webasm/system/release/kid_support.a /Parasolid/lx86/vdevel_webasm/system/release/pskernel_archive.a -o /u/jgd/regimes/webasm_vdevel/kid.js

Thanks, 

John Dallman  
Reply all
Reply to author
Forward
0 new messages