A JNI Wasm3 wrapper for Kotlin/Android.
let wasmModuleByteArray = context.assets.open("module.wasm")
let result = KWasm3.builder()
.withBinaryModule("module", wasmModuleByteArray)
.withStackSize(8192)
.withHostFunction<Int, Int>("env", "myImportedFunction"){ p1 -> p1 }
.build()
.call<Int>("myExportedFunction")
- Android Studio
- Android NDK (Installable through the Android SDK Manager)
- Rust (wasm32-unknown-unknown target) - Optional to compile WASM modules for tests
- Clone the repository to your local machine.
- Open Android Studio, and Choose "New Project from Existing Sources"
- Open the KWasm3 directory you cloned earlier
- Run the setup script to download and place WASM3 source in the correct folder to link against
$ ./scripts/setup.sh
- Build the project or run tests in the library module
- Bind host functions to wasm3
- Exported functions API return values
- Generify native project for use on the JVM and Android
- Bind imported memory to WASM3
- Expose Wasm3 Memory to host functions
- API to access exported memory through host functions
- Higher order type conversions (Strings etc...)
- Java Native Interface (JNI) Example
- WASM3 - The fastest WebAssembly Interpreter
- KWasm - Inspiration for the API