> Interesting, this means that your codebase has functions with 26 parameters,
I'll believe that. Not many, but a few. > emcc [..] -sEMULATE_FUNCTION_POINTER_CASTS -sBINARYEN_EXTRA_PASSES=--pass-arg=max-func-params@30 Excellent! Thanks, John Dallman On Tue, May 19, 2026 at 9:43 PM Alon Zakai <[email protected]> wrote: > > > On Sun, May 17, 2026 at 6:27 AM John Dallman <[email protected]> > wrote: > >> 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 >> > > Interesting, this means that your codebase has functions with 26 > parameters, and EMULATE_FUNCTION_POINTER_CASTS' default is 16. There is no > emcc flag for this, but you can pipe it through to wasm-opt: > > emcc [..] -sEMULATE_FUNCTION_POINTER_CASTS > -sBINARYEN_EXTRA_PASSES=--pass-arg=max-func-params@30 > > (BINARYEN_EXTRA_PASSES is added to the wasm-opt command that runs passes > like cast emulation, and --pass-arg is how wasm-opt passes flags to passes) > > 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. >> >> > Yes, wasm-opt is one of the Binaryen tools. > > > >> 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 >> >> -- >> You received this message because you are subscribed to the Google Groups >> "emscripten-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion visit >> https://groups.google.com/d/msgid/emscripten-discuss/CAH1xqg%3D_0z_7pPjfd9H9FzXYEEE%3DLkWhPs2zqgFzYoAxtHd5Mg%40mail.gmail.com >> <https://groups.google.com/d/msgid/emscripten-discuss/CAH1xqg%3D_0z_7pPjfd9H9FzXYEEE%3DLkWhPs2zqgFzYoAxtHd5Mg%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion visit > https://groups.google.com/d/msgid/emscripten-discuss/CAEX4NpRAgaBcUK5ftCcza7pewyrwwuKT%2Beuc82E5QNsuZ88Gmw%40mail.gmail.com > <https://groups.google.com/d/msgid/emscripten-discuss/CAEX4NpRAgaBcUK5ftCcza7pewyrwwuKT%2Beuc82E5QNsuZ88Gmw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/emscripten-discuss/CAH1xqgkwo6%2B53Hk%2B-_3JtojnUOG6WhGqbQfrEzLCBF5kbVy0Dg%40mail.gmail.com.
