Skip to content

Commit 23398af

Browse files
committed
Add missing delete hook for owned Func instance
1 parent 5ca0ab6 commit 23398af

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main.zig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ pub const Func = opaque {
212212
};
213213
}
214214

215+
pub fn deinit(self: *Func) void {
216+
wasm_func_delete(self);
217+
}
218+
215219
/// Returns tue if the given `kind` of `Valkind` can coerce to type `T`
216220
fn matchesKind(comptime T: type, kind: Valkind) bool {
217221
return switch (T) {
@@ -226,6 +230,7 @@ pub const Func = opaque {
226230
}
227231

228232
extern "c" fn wasm_func_new(*Store, ?*c_void, Callback) ?*Func;
233+
extern "c" fn wasm_func_delete(*Func) void;
229234
extern "c" fn wasm_func_as_extern(*Func) ?*Extern;
230235
extern "c" fn wasm_func_copy(*Func) ?*Func;
231236
extern "c" fn wasm_func_call(*Func, *const ValVec, *ValVec) ?*Trap;

0 commit comments

Comments
 (0)