It makes sense that this would only happen in debug build since these checks (the ones performed by createExportWrapper) are only included in debug builds.
I still can't seem to see how `__main_argc_argv` is being called. The `debugger eval code` might be a clue.. are you typing something into the DevTools to trigger this? I assume your main function is just being called in the normal way that emscripten does. e.g. via run -> doRun -> callMain -> wasmExports[`__main_argc_argv`]? or are you calling main some other way? Can you try setting a break point in `callMain` perhaps? Do you hit that before the error you see? On Tue, Apr 16, 2024 at 2:02 AM キャロウ マーク <git...@callow.im> wrote: > > > On Apr 16, 2024, at 12:39, 'Sam Clegg' via emscripten-discuss < > emscripten-discuss@googlegroups.com> wrote: > > > Can you click on the little red arrow next to the "Aborted" message in the > console? It should show the stack trace. > > > Aborted(Assertion failed: native function `__main_argc_argv` called before > runtime initialization) es3loadtests.js:789:6 > <http://127.0.0.1:8080/es3loadtests.js> > abort http://127.0.0.1:8080/es3loadtests.js:789 > assert http://127.0.0.1:8080/es3loadtests.js:522 > createExportWrapper http://127.0.0.1:8080/es3loadtests.js:836 > <anonymous> debugger eval code:1 > > Here is the createExportWrapper function with the assert that is firing > > function createExportWrapper(name, nargs) { > return (...args) => { > assert(runtimeInitialized, `native function \`${name}\` called before > runtime initialization`); > var f = wasmExports[name]; > assert(f, `exported native function \`${name}\` not found`); > // Only assert for too many arguments. Too few can be valid since the > missing arguments will be zero filled. > assert(args.length <= nargs, `native function \`${name}\` called with > ${args.length} args but expects ${nargs}`); > return f(...args); > }; > } > > This is only happening when the code is compiled -O0, -g. When compiled > -O3 the app runs with the debugger open. > > Regards > > -Mark > > -- > 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 emscripten-discuss+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/9A4B06C8-CFB9-4161-A378-B1EB50FA7278%40callow.im > <https://groups.google.com/d/msgid/emscripten-discuss/9A4B06C8-CFB9-4161-A378-B1EB50FA7278%40callow.im?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 emscripten-discuss+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAL_va280sUgubHmLgT4Ls9CUv%3DsTJjFp2xBZzauE4MzSni3ENQ%40mail.gmail.com.