3 ms·
There is the WASI SDK if you want to target WASI from C/C++: https://github.com/WebAssembly/wasi-sdk https://github.com/WebAssembly/wasi-sdk It comes with a l
by tempodox 3y ago
There is the WASI SDK if you want to target WASI from C/C++:
https://github.com/WebAssembly/wasi-sdk https://github.com/WebAssembly/wasi-sdk
It comes with a libc implemented in WASM.
- jedisct1 3y agoA common option for that purpose is Zig. WASI is just one of the many targets it can compile C code to, out of the box: `zig cc -target wasm32-wasi`. No need to install yet another LLVM copy. Zig produces more optimized code, because it optimizes the libc like the rest of the application. So you can enable additional WebAssembly features according to the target runtime, for example `zig cc -target wasm32-wasi -mcpu=baseline+bulk_memory+simd128`. And you get automatic caching for free.
- tempodox 3y agoThat's cool and all, but how do I get it to use a linker that understands those options I give to `wasm-ld` (`--allow-undefined`, `--export-all`, `--no-entry`)? As it is, I'm getting “error: unsupported linker arg: --allow-undefined” when I pass that with `-Wl,`.
- jedisct1 3y ago-Wl,--import-symbols -Wl,--export-all-symbols -Wl,--entry= (or rather -mexec-model=reactor).