What's the use case?
Show HN: Compiling C in the browser using WebAssembly
51–60 of 74 posts
Re: Show HN: Compiling C in the browser using WebAssembly
#52Now all this needs is a simple OS running in a browser, that can edit and compile itself, post the resulting binary onto a WebDAV somewhere, and reload itself from there. Then it becomes a fully self-sustaining OS that can live forever in a browser.
And then use webrtc (or ideally someone can revive a webtransport-p2p please !) to serve itself from a page to other people. Ideally http3 over webtransport-p2p! Then add some network discovery so we can advertise & find what's available on our networks!
What is it that needs reviving?
Re: Show HN: Compiling C in the browser using WebAssembly
#53GCC? That's easy! :-) What about a complete system? https://webvm.io Shameless plug: we are hosting a WebVM Hackathon next week (11-14 October) over Discord. For more information: https://cheerpx.io/hackathon
Re: Show HN: Compiling C in the browser using WebAssembly
#54GCC? That's easy! :-) What about a complete system? https://webvm.io Shameless plug: we are hosting a WebVM Hackathon next week (11-14 October) over Discord. For more information: https://cheerpx.io/hackathon
Can I compete with exaequOS?
Re: Show HN: Compiling C in the browser using WebAssembly
#55GCC? That's easy! :-) What about a complete system? https://webvm.io Shameless plug: we are hosting a WebVM Hackathon next week (11-14 October) over Discord. For more information: https://cheerpx.io/hackathon
Re: Show HN: Compiling C in the browser using WebAssembly
#56 panicked at /Users/syrusakbary/Development/wasmer/lib/api/src/js/instance.rs:62:84:
called `Result::unwrap()` on an `Err` value: JsValue(Function(bound 846))
Stack:
fe/_.wbg.__wbg_new_abda76e883ba8a5f@https://wasmer.sh/assets/index-CgFg6VHw.js:17:6582
@https://wasmer.sh/assets/wasmer_js_bg-BruS15W0.wasm:wasm-function[1125]:0x2b4276
@https://wasmer.sh/assets/wasmer_js_bg-BruS15W0.wasm:wasm-function[2888]:0x3ab373
@https://wasmer.sh/assets/wasmer_js_bg-BruS15W0.wasm:wasm-function[8254]:0x435ed3
@https://wasmer.sh/assets/wasmer_js_bg-BruS15W0.wasm:wasm-function[4825]:0x3fa7de
@https://wasmer.sh/assets/wasmer_js_bg-BruS15W0.wasm:wasm-function[517]:0x1af753
@https://wasmer.sh/assets/wasmer_js_bg-BruS15W0.wasm:wasm-function[294]:0xbed03
@https://wasmer.sh/assets/wasmer_js_bg-BruS15W0.wasm:wasm-function[2039]:0x34b10e
@https://wasmer.sh/assets/wasmer_js_bg-BruS15W0.wasm:wasm-function[2896]:0x3abaa1
@https://wasmer.sh/assets/wasmer_js_bg-BruS15W0.wasm:wasm-function[9393]:0x43fde1
S@https://wasmer.sh/assets/index-CgFg6VHw.js:11:424
c@https://wasmer.sh/assets/index-CgFg6VHw.js:11:264Re: Show HN: Compiling C in the browser using WebAssembly
#57Every few years, new progresses might remind me of this talk by Gary Bernhardt: https://www.destroyallsoftware.com/talks/the-birth-and-death...
Re: Show HN: Compiling C in the browser using WebAssembly
#58Earlier quoted context omitted.
Presumably C's `switch` is also a problem.
Yes, I don't recall all the confusing elements and technicalities of what's allowed in Switch statements in C offhand but here are a few brainfscks: https://old.reddit.com/r/C_Programming/comments/16kg48y/mind... https://old.reddit.com/r/programminghorror/comments/ylc7f3/w...
Found a comment from the author of https://github.com/stclib/STC apparently and then came across this example:
https://stackoverflow.com/a/76887723
int coro_a(struct a* g)
{
cco_routine (g) {
printf("entering a\n");
for (g->i = 0; g->i i++) {
printf("A step %d\n", g->i);
cco_yield();
}
cco_final:
printf("returning from a\n");
}
return 0; // done
}
gcc -E -ISTC/include co.cAfter running it through a preprocessor, it gives me this.
int coro_a(struct a* g)
{
for (int* _state = &(g)->cco_state; *_state != CCO_STATE_DONE; *_state = CCO_STATE_DONE) _resume: switch (*_state) case 0: {
printf("entering a\n");
for (g->i = 0; g->i i++) {
printf("A step %d\n", g->i);
do { *_state = 14; return CCO_YIELD; goto _resume; case 14:; } while (0);
}
*_state = CCO_STATE_FINAL; case CCO_STATE_FINAL:
printf("returning from a\n");
}
return 0;
}Re: Show HN: Compiling C in the browser using WebAssembly
#59Re: Show HN: Compiling C in the browser using WebAssembly
#60GCC? That's easy! :-) What about a complete system? https://webvm.io Shameless plug: we are hosting a WebVM Hackathon next week (11-14 October) over Discord. For more information: https://cheerpx.io/hackathon
What about something that doesn't even require WebAssembly and is faster? https://bellard.org/jslinux/
jslinux: 4.7s
wasmer: 1.3s
webvm: 1.2s