emscripten-core / emscripten-core/emscripten
Document the initialization order
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
This is a reminder that I need to add this to the docs somewhere....
Initialization Order
- Top Level Code (or init() when MODULARIZE=instance)
- Await createWasm()
- getWasmImports
- Await instanitateAsync
- WebAssembly.instantiateStreaming
- receiveInstantiationResult
- Assign wasmExports
- Remove run dependencies “wasm-instantiate”
- Assign globals from wasmExports
- Call Module\[“preInit”\] (if defined)
- run()
- (may bail of runDependencies not empty)
- preRun()
- Call Module\[“preRun”\] (if defined)
- Call \_\_ATPRERUN\_\_
- doRun()
- initRuntime()
- Call \_\_ATINIT\_\_
- $\_\_wasm\_call\_ctors
- ?? embindUpdateExports
- preMain()
- Call \_\_ATMAIN\_\_
- readyPromiseResolve
- Call Module\[“onRuntimeInitialized”\] (if defined)
- callMain() (if shouldRun)
- Throws exception to quit
- postRun()
- Call Module\[“postRun”\] (if defined)
- Call \_\_ATPOSTRUN\_\_
Contributor guide
Assessment
This issue has not been assessed yet.