No-std WASM runtime and help with getting started

So I've got a couple questions:

  1. What is a good and high-quality no_std WASM runtime? I know that Wasmtime exists but that's not no_std and probably won't be for a while.
  2. What is a good process for getting started writing WASM binaries in a non-web environment? All the WASM stuff I've seen -- even the WASM book that Rust has -- talks about using WASM in a web browser, but I want to do it in a non-web browser context, so none of the web crates will satisfy.
    Thoughts?

What are the exact constraints that the WASM runtime needs to run in? Can it allocate memory? Can it map pages as executable for JITing? Can libc be used? Does it need to run inside a kernel, on a micro processor, ...?

It can allocate memory and JITting should work (preferable if JITting was possible). It should run within a kernel; libc is not available. The environment allows pages to be mapped as writable or executable but not both.

I know that Wasmer exists.... But does it support no_std? I might've enquired about it before but I can't remember.

wasmer has no chance to ever be able to become #[no_std], it is very complex and depends on LLVM or Cranelift.

However the interpreter wasmi seems to support #[no_std].

Thank you! That works! What about a good way of getting started with writing WASM modules? Ones that don't rely on a web browser? What do I have to include in WASM modules for that to work, how do I expose functions, that kind of thing.

This article might be useful: Making really tiny WebAssembly graphics demos - Cliffle

2 Likes

That did help, thanks for that. I didn't think writing WebAssembly was that easy.

1 Like