dispatchrun / wasi-go

A Go implementation of the WebAssembly System Interface (WASI)
Apache License 2.0
124 stars 7 forks source link

wasirun: support WasmEdge v1 #23

Closed chriso closed 1 year ago

chriso commented 1 year ago

Following up from https://github.com/stealthrocket/wasi-go/pull/20, this PR adds basic WasmEdge v1 support. We can reliably detect whether the WASM module was compiled with the V1 or V2 API, and setup the necessary host module. The user shouldn't have to do anything, since --sockets auto is the default.

V1 is mostly the same; there are a few minor differences. I've left a few stubs/TODOs for later.

I'm now able to run the examples from https://github.com/second-state/wasm-learning and https://github.com/second-state/wasmedge_wasi_socket, and the WasmEdge Python version from https://github.com/vmware-labs/webassembly-language-runtimes/releases:

$ wasirun python-3.11.3-wasmedge.wasm                   
Python 3.11.3 (tags/v3.11.3:f3909b8, Apr 28 2023, 09:52:05) [Clang 15.0.7 ] on wasi
Type "help", "copyright", "credits" or "license" for more information.
>>>