[MODS/VM]: Get calls to deinit working and call deinit on sideros_cleanup
This commit is contained in:
parent
120da3e3cd
commit
3b8ea60141
5 changed files with 80 additions and 44 deletions
|
|
@ -34,6 +34,7 @@ pub const Function = struct { func_type: Functype, typ: union(enum) {
|
|||
|
||||
pub const ExportFunction = enum {
|
||||
init,
|
||||
deinit,
|
||||
logErr,
|
||||
logWarn,
|
||||
logInfo,
|
||||
|
|
@ -41,6 +42,7 @@ pub const ExportFunction = enum {
|
|||
};
|
||||
pub const Exports = struct {
|
||||
init: ?u32 = null,
|
||||
deinit: ?u32 = null,
|
||||
logErr: ?u32 = null,
|
||||
logWarn: ?u32 = null,
|
||||
logInfo: ?u32 = null,
|
||||
|
|
@ -647,6 +649,13 @@ pub const Runtime = struct {
|
|||
std.debug.panic("Function init unavailable\n", .{});
|
||||
}
|
||||
},
|
||||
.deinit => {
|
||||
if (self.module.exports.deinit) |func| {
|
||||
try self.call(allocator, func, parameters);
|
||||
} else {
|
||||
std.debug.panic("Function deinit unavailable\n", .{});
|
||||
}
|
||||
},
|
||||
else => {
|
||||
std.debug.panic("Function {any} not handled\n", .{name});
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue