4 ms·
I find WASM in general very cool. Is there a way to run a WASM "binary" locally? For example, can I distribute a program as WASM and execute ./mywasmprogram and
by stavros 5y ago
I find WASM in general very cool. Is there a way to run a WASM "binary" locally? For example, can I distribute a program as WASM and execute ./mywasmprogram and have it run?
I imagine I need a WASM runtime installed, and to somehow get my shell to recognize that WASM programs should be loaded with it (for lack of a hashbang line), but is that actually doable?
- simonw 5y agoYes, definitely. Wasmer is one way to do that: https://docs.wasmer.io/ecosystem/wasmer/getting-started https://docs.wasmer.io/ecosystem/wasmer/getting-started
- stavros 5y agoExcellent, thank you! I knew of Wasmer but didn't realize that's what it was. I look forward to the day where we can just distribute one architecture-independent binary.
- wffurr 5y agoLike a .jar file?
- tormeh 5y agoYes, but with a much leaner, memory-efficient, and more secure runtime. WASM is kinda "JVM without the Java bits" but that's a good thing. Having the VM provide facilities for GC is not necessary. Go shows that you can embed it in the executable. And Java bytecode is too close to Java code and not close enough to machine code, and so the VM has to provide a full interpreter - also unnecessary.
- teddyh 5y agoNote: There was some discussion of Wasmer here a couple of days ago: https://news.ycombinator.com/item?id=30758651 https://news.ycombinator.com/item?id=30758651
- gmatejka 5y agoYou can also use node to execute webassembly programs. You do have to create a js host file, load in your webassembly and then run it with node.
- adamredwoods 5y agoThe WASI interface even has system file access: https://nodejs.org/docs/latest-v17.x/api/wasi.html https://nodejs.org/docs/latest-v17.x/api/wasi.html
- Klasiaster 5y agowasmtime, Standalone JIT-style runtime for WebAssembly, using Cranelift: https://github.com/bytecodealliance/wasmtime https://github.com/bytecodealliance/wasmtime wasm3, WebAssembly interpreter: https://github.com/wasm3/wasm3 https://github.com/wasm3/wasm3 … and many more