It sounded good until this part. Would have been nice if it were written in the subset of C that it supports, so it could compile the compiler to Wasm.
I'm working on a custom wasm app runtime and I don't want to have to implement the entire API surface of Emscripten or WASI. The new component model is even more complex. I wish there was more tooling available for using C/Rust stdlib functions for things like reading files or opening a socket, but being able to define your own API to handle the actually operations in the host/module interface.
https://ziggit.dev/t/wasm-index-out-of-bounds-only-in-debug-...
--target=wasm32
option. It creates small binaries. My 16-Bit x86 emulator with BIOS and DOS emulation is under 100kB [0].
Personally, although I do use wasi-sdk (clang) and the wasm32-unknown-wasi triple, the result can be basically free-standing, depending on what flags you use.
As a sibling post said, optimization matters, and using wasm-ctor-eval and wasm-opt also helps. But it's useful to keep full C semantics.
[0] https://github.com/s-macke/FSHistory/tree/master/src/wasm_li...
This is what I've been doing for my little non-WASI runtime. For my minimal programs I find only a few wasi exports are required, which don't appear to actually be used and I just stub them out. Would love to figure out how to get rid of the code depending on them entirely but it's lower priority.
Also, you probably want to build a reactor (-mexec-model=reactor) if that's not what you're already doing. A command will use WASI to read command-line arguments and environment.
But it's hard to tell without knowing the specific imports you're trying to get rid of.
I've seen a few of these WASM emulators and fantasy consoles, but they all seem to be focused on games. Are you aware of any that are designed to run normal GUI apps?
At least, it doesn't require K&R syntax for functions!
Isnt that quite common now with machine generated code. Look at nim clientside js, I dear any js dev to try to navigate that.
The point is should we just trust the machine generated as it is and hope that the compiler/bundler just did a correct job, or just write clean and simple code
comex•7mo ago
[1] https://github.com/kign/c4wa/blob/master/etc/doc/comparison....
soegaard•7mo ago