Stream: wasi

Topic: How to get the Wasm, WASI, & SDK version via C macros


view this post on Zulip Brett Cannon (Dec 03 2025 at 18:14):

I'm looking to get the Wasm version (e.g. wasm32), WASI version (e.g. 0.2), and WASI SDK version (e.g. 29) at compile time for some C code (specifically CPython). Neither https://github.com/WebAssembly/wasi-sdk nor https://github.com/WebAssembly/wasi-libc list any predefined macros in any docs that I can find (e.g. __WASI_VERSION__ or something). Do such macros exist?

WASI-enabled WebAssembly C/C++ toolchain. Contribute to WebAssembly/wasi-sdk development by creating an account on GitHub.
WASI libc implementation for WebAssembly. Contribute to WebAssembly/wasi-libc development by creating an account on GitHub.

view this post on Zulip Alex Crichton (Dec 03 2025 at 18:22):

wasm32/wasm64 is __wasm32__ and __wasm64__ I believe, but the libc/sdk versions aren't present in macros -- would be reasonable to add though!

view this post on Zulip Brett Cannon (Dec 03 2025 at 18:39):

The reason I ask is I will need to embed that data in Python wheels and it probably wouldn't hurt to expose it in Python itself.

Where should I open an issue? WASI SDK or wasi-libc?

view this post on Zulip Alex Crichton (Dec 03 2025 at 18:42):

wasi-libc is probably the best spot since that's where the headers will be located and #defines and such

view this post on Zulip Alex Crichton (Dec 03 2025 at 18:42):

and definitely agree it'd be good to have these

view this post on Zulip Brett Cannon (Dec 03 2025 at 18:53):

https://github.com/WebAssembly/wasi-libc/issues/688

Brought up on Zulip#wasi > How to get the Wasm, WASI, & SDK version via C macros, having a way to get the compile-time values of the WASI version (e.g. 0.2) as well as the WASI SDK version (e.g. 29...

Last updated: Dec 06 2025 at 06:05 UTC