Based on WAMR Rust SDK. It is the wrapper of wasm_export.h but with Zig style.
- Runtime. It is the environment that hosts all the wasm modules. Each process has one runtime instance.
- Module. It is the compiled .wasm or .aot. It can be loaded into runtime and instantiated into instance.
- Instance. It is the running instance of a module. It can be used to call export functions.
- Function. It is the exported function.
- WASIArgs. It is used to configure the WASI environment.
- pre-open. All files and directories in the list will be opened before the .wasm or .aot loaded.
- allowed address. All ip addresses in the allowed address list will be allowed to connect with a socket.
- allowed DNS.
- New project
# Create directory
$ mkdir project-name
$ cd project-name
$ zig init
# Add dependency in zon file
$ zig fetch --save=wamr-zig git+https://github.com/wamr-zig/wamr-zig
Add in build.zig
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const wamr_zig = b.dependency("wamr-zig", .{
.target = target,
.optimize = optimize,
});
// your project
[exe|lib].root_module.addImport("wamr", wamr_zig.module("wamr"));
}