There are some workarounds here, which might help in some cases. One is to preload the library files, then the loader code will compile them asynchronously before the main program runs. Basically just preloading the files normally will work, if they have the suffix ".so", see https://github.com/emscripten-core/emscripten/blob/incoming/src/library_browser.js#L233
Another option is to call loadWebAssemblyModule manually, and pass it loadAsync: true, like the plugin does in the above link. Thanks for helping document this! On Fri, Feb 1, 2019 at 3:22 PM Beuc <[email protected]> wrote: > Hi, > > When experimenting with dlopen() I remembered that Chromium doesn't > support compiling non-trivial WASM on the main thread, and consequently > dlopen() is unusable: > > RangeError: WebAssembly.Compile is disallowed on the main thread, if the > buffer size is larger than 4KB. Use WebAssembly.compile, or compile on a > worker thread. > > I added a note at > https://github.com/emscripten-core/emscripten/wiki/Linking > Is there a work-around to document (aside from moving everything to a > worker, which is not practical)? > > - Beuc > > -- > 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]. > For more options, visit https://groups.google.com/d/optout. > -- 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]. For more options, visit https://groups.google.com/d/optout.
