wasi2ic: WASI Polyfill Tool
wasi2ic is a command-line tool that replaces WebAssembly System Interface (WASI) specific function calls with their
corresponding polyfill implementations. This allows you to run Wasm binaries compiled for wasm32-wasi on the Internet
Computer.
Installation
Install wasi2ic using Cargo:
Usage
Replace WASI dependencies in a Wasm file using:
This command reads the input Wasm file, removes WASI dependencies, and reroutes WASI calls to their IC-specific implementations. Note that the polyfill implementation must be present in your Wasm binary.
To include the polyfill implementation in your Canister project, add the ic-wasi-polyfill dependency in it:
Also you will need to add the initialization call to the polyfill library, basic example featuring user memory manager:
use ;
use RefCell;
thread_local!
For more detailed information, see our examples repository.
Related repositories
| Repository | Description |
|---|---|
| ic-wasi-polyfill | Polyfill library implementing the low-level WASI calls. |
| stable-fs | Simple file system implementation based on the stable structures. The file system implements backend for the ic-wasi-polyfill |
| examples | Repository containing various examplpes of running WASI projects on the IC. |