emscripten-core / emscripten-core/emscripten

ASYNCIFY and INCOMING_MODULE_JS_API

Open
#21,955 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

I noticed that if I use `ASYNCIFY` and `INCOMING_MODULE_JS_API` together, then I must include `noExitRuntime` in the `INCOMING_MODULE_JS_API` list even if I don't actually provide it in the `Module`, otherwise Asyncify won't work. Apparently this has to do with this part of the code:

https://github.com/emscripten-core/emscripten/blob/9ac0425b20d0c1befb54e61d334b245bdb97c0e0/src/library.js#L3012-L3019

Which implies that if `noExitRuntime` is not included in the list, `keepRuntimeAlive()` will always return `false` so Asyncify is impossible. But why would I add it to the list if I don't intend to provide it? This seems like a bug to me.

**Version of emscripten/emsdk:**
```
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.59 (0e4c5994eb5b8defd38367a416d0703fd506ad81)
clang version 19.0.0git (https:/github.com/llvm/llvm-project df762a1643bb5b0b3c907611d118c82d4b68a39d)
Target: wasm32-unknown-emscripten
Thread model: posix
```

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.