logoalt Hacker News

logicallee • today at 5:04 AM • 3 replies • view on HN

Could I ask how you do that? How do you actually build with a webassembly target? I might be interested.


Replies

wffurr • today at 7:04 AM

From the TinyGo docs, it’s as simple as

    GOOS=js GOARCH=wasm tinygo build -o wasm.wasm ./main.go
https://tinygo.org/docs/guides/webassembly/wasm/

It relies on LLVM’s Wasm backend and some JS glue libraries for the browser.

KingOfCoders • today at 5:37 AM

<Shameless plug> https://appfuzz.dev/ https://appos.build/

➕ show 1 reply
01HNNWZ0MV43FF • today at 5:52 AM

So you want to take arbitrary code in arbitrary languages, and run it on someone else's computer inside a sandbox?

Yes, wasm can do that.

You can compile the code to wasm, then run it in a runtime like wasmer or wasmtime. Or you can ahead-of-time compile it with something like wasm2c, which generates C code.