Closed malcolmstill closed 1 year ago
Wrap the calls to .wasm module functions in a struct that carries its instance
.wasm
E.g. for fib.wasm we get:
fib.wasm
pub const Api = struct { instance: *zware.Instance, const Self = @This(); pub fn init(instance: *zware.Instance) Self { return .{ .instance = instance }; } pub fn fib(self: *Self, param0: i32) !i32 { var in = [_]u64{@bitCast(@as(i64, param0))}; var out = [_]u64{0}; try self.instance.invoke("fib", in[0..], out[0..], .{}); return @bitCast(@as(u32, @truncate(out[0]))); } };
Description
Wrap the calls to
.wasm
module functions in a struct that carries its instanceE.g. for
fib.wasm
we get: