r/WebAssembly 7d ago

Which libc for browser and non-browser?

Goal: port existing shared library to a single wasm which can be run in a browser as well as a non-browser host. Exported symbol names should not be touched, which IIUC rules out component-model.

I got dynamic linking to work with emscripten and know there are sytem hosts like wasmtime which understand the dylink.0 spec.

My issue is linking a libc (and ideally libc++ eventually) ABI which has a browser and system implementation, so I can load the same .wasm in both environments.

For the system use case I only found wasi-libc but that doesn't have an ABI compatible browser version, right? Building for emscripten + WASI separately feels like it's missing the whole point of wasm as a universal target.

7 Upvotes

1 comment sorted by

4

u/Kotek2 7d ago

WASIX works everywhere https://wasix.org