-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
While attempting to get SQLite building with Emscripten 4.0.0 we've discovered that our --extern-post-js code is failing because initialization which has formerly been done via Module.postRun
is no longer being run (or is perhaps being run later than it historically did and we can't get to that point because our --extern-post-js requires the prior ordering).
This is most easily demonstrated with some console debug output comparing 3.1.74 (the last 3.1 release) and 4.0.0:
The relevant part is the 3rd yellow line on the left. That line, from the start of a Module.postRun handler, is never hit in 4.0.0.
i've not found any relevant change mentioned in recent change logs.
Adding this silly workaround to our extern-post-js code, from the then() handler of calling the EXPORT_NAME-defined module init function, works around the problem:
if( EmscriptenModule.postRun && EmscriptenModule.postRun.length ){
/* Emscripten 4.0.0 does not run postRun(). */
console.warn("Emscripten did not run postRun: running them now!");
EmscriptenModule.postRun.shift()(EmscriptenModule);
}
Which makes it now behave like 3.1.74 except for the later timing of postRun():