4 ms·
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”
by chatmasta 7y ago
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?
- follower 7y agoI'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://github.com/bytecodealliance/wasmtime * https://wasmerio.github.io/wasmer/c/runtime-c-api/ 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 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/ 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 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/ https://wasdk.github.io/WasmFiddle/ Some of my notes from development so far: http://www.labradoc.com/i/follower/p/notes-webassembly#20200124 http://www.labradoc.com/i/follower/p/notes-webassembly#20200... Edit: Grammar. Add & then move micro WASM VM link.
- chatmasta 7y agoThanks for all the info! Looks like I've got some Sunday reading. :)