Skip to content

Disable standalone executable support under WASM / Emscripten#1528

Merged
saghul merged 1 commit into
masterfrom
wasm-disable-standalone
Jun 10, 2026
Merged

Disable standalone executable support under WASM / Emscripten#1528
saghul merged 1 commit into
masterfrom
wasm-disable-standalone

Conversation

@saghul

@saghul saghul commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Closes: #1527

@bnoordhuis bnoordhuis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of commenting out big blocks of code, it's more robust to do something like:

#if defined(EMSCRIPTEN) || defined(__wasi__)
#define emscripten_or_wasi 1
#else
#define emscripten_or_wasi 0
#endif

And then instead of ifdef'ing out code, like this:

#if !defined(EMSCRIPTEN) && !defined(__wasi__)
do_the_thing();
#endif

You do:

if (!emscripten_or_wasi) {
    do_the_thing();
}

That way all code is always compiler-checked.

Comment thread qjs.c Outdated
Comment on lines +693 to +696
} else if (expr) {
#else
if (expr) {
#endif

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this instead?

Suggested change
} else if (expr) {
#else
if (expr) {
#endif
}
#endif
if (!standalone && expr) {

Arguably mildly easier to read.

@saghul saghul force-pushed the wasm-disable-standalone branch from 54244ea to 37a7dc2 Compare June 9, 2026 21:44
@saghul saghul force-pushed the wasm-disable-standalone branch from 37a7dc2 to 3b1c108 Compare June 9, 2026 21:56
@saghul saghul merged commit ed80a90 into master Jun 10, 2026
124 checks passed
@saghul saghul deleted the wasm-disable-standalone branch June 10, 2026 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--std --compile doesn't make std, et al. available to compiled executable

2 participants