Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There is the WASI SDK if you want to target WASI from C/C++:

https://github.com/WebAssembly/wasi-sdk

It comes with a libc implemented in WASM.



A 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.


That'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,`.


-Wl,--import-symbols -Wl,--export-all-symbols -Wl,--entry= (or rather -mexec-model=reactor).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: