From 680b6282f30505d9531d4ca579aa35e23843bde2 Mon Sep 17 00:00:00 2001 From: Connor Rigby Date: Thu, 22 Dec 2022 14:05:31 -0800 Subject: [PATCH] stdlib: allow app to override the zig os layer (#93) --- src/core/microzig.zig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/microzig.zig b/src/core/microzig.zig index c755315..cc3b7b5 100644 --- a/src/core/microzig.zig +++ b/src/core/microzig.zig @@ -48,6 +48,12 @@ pub const debug = @import("debug.zig"); pub const mmio = @import("mmio.zig"); +// Allow app to override the os API layer +pub const os = if (@hasDecl(app, "os")) + app.os +else + struct {}; + // Allow app to override the panic handler pub const panic = if (@hasDecl(app, "panic")) app.panic