summaryrefslogtreecommitdiff
path: root/src/sketch/root.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-16 22:57:31 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commit88c04dd6c392c6d8fc3a02408506e85d86f476d5 (patch)
tree4462fcb19dce110c24595f000bd8303c69288689 /src/sketch/root.zig
parent1cb36ee39a8bbc2cf61c28003670d760841d6d3e (diff)
downloadsketchbook-88c04dd6c392c6d8fc3a02408506e85d86f476d5.tar.gz
sketchbook-88c04dd6c392c6d8fc3a02408506e85d86f476d5.zip
Refuse a sketch library built by another compiler, backend or mode
abi.hash now covers the zig version, codegen backend and optimize mode: Zig's own calling convention (Host.VTable, every Allocator) differs between them, so a Debug host loading a ReleaseFast or LLVM library faulted on its first draw. Libraries export sketch_build, and the host's refusal says what differs and what to run instead.
Diffstat (limited to 'src/sketch/root.zig')
-rw-r--r--src/sketch/root.zig3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/sketch/root.zig b/src/sketch/root.zig
index cb20ab9..bc09add 100644
--- a/src/sketch/root.zig
+++ b/src/sketch/root.zig
@@ -317,6 +317,7 @@ pub fn exportSketch(comptime App: type) void {
@export(&G.update, .{ .name = names.update });
@export(&G.draw, .{ .name = names.draw });
@export(&G.command, .{ .name = names.command });
+ @export(&G.build, .{ .name = "sketch_build" });
}
pub fn Glue(comptime App: type) type {
@@ -325,6 +326,8 @@ pub fn Glue(comptime App: type) type {
pub const Session = if (@hasDecl(App, "Session")) App.Session else struct {};
pub const Store = if (@hasDecl(App, "Store")) App.Store else struct {};
+ const build: [abi.build.len:0]u8 = abi.build.*;
+
pub const description: abi.Info = .{
.abi = abi.hash,
.name = if (@hasDecl(App, "name")) App.name else "sketch",