4 ms·
The WASI tutorial for compiling C/Rust to wasm and running it has some useful information on this front: https://github.com/bytecodealliance/wasmtime/blob/maste
by froydnj 7y ago
The WASI tutorial for compiling C/Rust to wasm and running it has some useful information on this front: https://github.com/bytecodealliance/wasmtime/blob/master/docs/WASI-tutorial.md https://github.com/bytecodealliance/wasmtime/blob/master/doc...
We wouldn't have been able to put wasm in Firefox like this if there wasn't decent compiler/runtime support via the clang ecosystem.
- wahern 7y agoThat C code has a bug where the inner write loop writes the same portion of the buffer after a short write. The Rust code, by contrast, slurps up the entire file contents into a buffer before writing it out. If someone is going to write code that way why even bother with a low-level language? (This "memory is infinite" mentality is something I've noticed in other Rust projects, even major ones like mio.)
- sunfish 7y agoGood catch on that bug! I'll fix that. Beyond that, that file is just a simple example for showing how to work with the toolchain and the sandbox.