Hacker News new | past | comments | ask | show | jobs | submit login

What is the state of the art for WASM VM scripting? Adding Lua to a C program requires very little effort. Is the same true of WASM? What is the best “drop in” WASM VM for C programming?



I've recently been working on WASM VM embedding with C (well, via libffi) for a personal project and uncovered a couple of WASM VM options, wasmtime & wasmer:

* https://github.com/bytecodealliance/wasmtime

* https://wasmerio.github.io/wasmer/c/runtime-c-api/

The underlying implementation of each is written in Rust.

(Recently I also discovered there's a "micro VM" too: https://github.com/bytecodealliance/wasm-micro-runtime)

The official WASM C API is still WIP but wasmtime targets it directly: https://github.com/WebAssembly/wasm-c-api/

Not sure if Wasmer is aiming for compatibility with the official WASM C API currently.

From my experience, Wasmtime's C support is probably best described as "under-documented but functioning".

I haven't implemented anything with Wasmer.

My impression is that Wasmer may offer a higher level API than Wasmtime but not sure if it counts as "drop in" yet.

Part of the reason why I ended up going with Wasmtime was...I kinda forgot Wasmer existed. :D But also I do like that they're targeting what will hopefully become a standard API--but I think that results in a lower level API than what is most "friendly" for starting out.

Been meaning to make this embedded Wasmtime C API example--created while figuring things out--public after tidying it up a bit more but... well, I just now made it public, as is (it at least has a ReadMe now :D ): https://gitlab.com/RancidBacon/wasm-embed-test :)

Also, this is one option for test compiling C to WASM without setting up a tool chain: https://wasdk.github.io/WasmFiddle/

Some of my notes from development so far: http://www.labradoc.com/i/follower/p/notes-webassembly#20200...

Edit: Grammar. Add & then move micro WASM VM link.


Thanks for all the info! Looks like I've got some Sunday reading. :)




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: