From 6848e1c9d7ee412fafb5cb186f2a72ab195d08d8 Mon Sep 17 00:00:00 2001 From: Vincent Rischmann Date: Sat, 15 Feb 2025 23:55:18 +0100 Subject: examples(zigcrypto): fix for windows --- examples/zigcrypto_test.zig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/zigcrypto_test.zig b/examples/zigcrypto_test.zig index 69a30bc..9c966ac 100644 --- a/examples/zigcrypto_test.zig +++ b/examples/zigcrypto_test.zig @@ -1,3 +1,4 @@ +const builtin = @import("builtin"); const std = @import("std"); const debug = std.debug; const mem = std.mem; @@ -24,8 +25,13 @@ pub fn main() anyerror!void { } { + const extension_path = if (builtin.os.tag == .windows) + "./zig-out/bin/zigcrypto.dll" + else + "./zig-out/lib/libzigcrypto"; + var pzErrMsg: [*c]u8 = undefined; - const result = sqlite.c.sqlite3_load_extension(db.db, "./zig-out/lib/libzigcrypto", null, &pzErrMsg); + const result = sqlite.c.sqlite3_load_extension(db.db, extension_path, null, &pzErrMsg); if (result != sqlite.c.SQLITE_OK) { const err = sqlite.c.sqlite3_errstr(result); std.debug.panic("unable to load extension, err: {s}, err message: {s}\n", .{ err, std.mem.sliceTo(pzErrMsg, 0) }); -- cgit v1.2.3