emscripten-core / emscripten-core/emscripten

Document the initialization order

Open
#23,492 1 comment 0 reactions 1 assignee Claimed by @brendandahl View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.