We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e8f09a7 commit f995d7fCopy full SHA for f995d7f
src/wasm.zig
@@ -340,6 +340,21 @@ pub const Instance = opaque {
340
return instance orelse Error.InstanceInit;
341
}
342
343
+ pub fn initFromImports(store: *Store, module: *Module, imports: *ExternVec) !*Instance {
344
+ var trap: ?*Trap = null;
345
+
346
+ const instance = wasm_instance_new(store, module, imports, &trap);
347
348
+ if (trap) |t| {
349
+ defer t.deinit();
350
+ // TODO handle trap message
351
+ log.err("code unexpectedly trapped", .{});
352
+ return Error.InstanceInit;
353
+ }
354
355
+ return instance orelse Error.InstanceInit;
356
357
358
/// Returns an export func by its name if found
359
/// Asserts the export is of type `Func`
360
/// The returned `Func` is a copy and must be freed by the caller
0 commit comments