This is the (incomplete) Swift implementation of the waPC standard for WebAssembly host runtimes.
Refer to the Tests for usage examples with the included "hello" sample modules.
This library is not fully implemented yet. The following is an incomplete list of functionality this library requires:
- Run a WebAssembly Module originally written in Rust
- Run a WebAssembly Module originally written in TinyGo
- Run a WebAssembly Module originally written in Zig
- Run a WebAssembly Module originally written in AssemblyScript (Does not work)
- Run a WebAssembly Module originally written in Swift (Untested)
- Provide host call upon WapcHost initialization instead of predefined log implementation
- Implement
__console_logHost Guest calls host to log to host’s stdout (if permitted) - Implement
__host_callHost Guest calls to request the host perform an operation - Implement
__host_responseHost Tells the host the pointer address at which to store its response - Implement
__host_response_lenHost Returns the length of the host’s response - Implement
__host_errorHost Tells the host the pointer address at which to store its error blob - Implement
__host_error_lenHost Returns the length of the host error blob - Implement
__guest_responseHost Called by the guest to set the pointer and length of the guest’s response blob - Implement
__guest_errorHost Called by the guest to set the pointer and length of the guest’s error blob - Implement
__guest_requestHost Called by the guest to tell the host the pointer addresses of where to store the request’s operation (string) and request payload (blob) values. - Implement
__guest_callGuest Invoked by the host to tell the guest to begin processing a function call. The guest will then retrieve the parameters and set response values via host calls. - Resolve state capturing that happens when registering handler functions, specifically with
__guest_requestthat necessitates us to calladdImportHandleronly after the__guest_callfunction is called.