summaryrefslogtreecommitdiff
path: root/examples/zigcrypto_test.zig
diff options
context:
space:
mode:
authorGravatar Vincent Rischmann2025-02-15 23:55:18 +0100
committerGravatar Vincent Rischmann2025-02-16 00:02:44 +0100
commit6848e1c9d7ee412fafb5cb186f2a72ab195d08d8 (patch)
tree93f19a2fddb4d2e7a88ade460dbf0b75893caf9e /examples/zigcrypto_test.zig
parentthe loadable extension is tested with the 'test' target (diff)
downloadzig-sqlite-6848e1c9d7ee412fafb5cb186f2a72ab195d08d8.tar.gz
zig-sqlite-6848e1c9d7ee412fafb5cb186f2a72ab195d08d8.tar.xz
zig-sqlite-6848e1c9d7ee412fafb5cb186f2a72ab195d08d8.zip
examples(zigcrypto): fix for windows
Diffstat (limited to 'examples/zigcrypto_test.zig')
-rw-r--r--examples/zigcrypto_test.zig8
1 files changed, 7 insertions, 1 deletions
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 @@
1const builtin = @import("builtin");
1const std = @import("std"); 2const std = @import("std");
2const debug = std.debug; 3const debug = std.debug;
3const mem = std.mem; 4const mem = std.mem;
@@ -24,8 +25,13 @@ pub fn main() anyerror!void {
24 } 25 }
25 26
26 { 27 {
28 const extension_path = if (builtin.os.tag == .windows)
29 "./zig-out/bin/zigcrypto.dll"
30 else
31 "./zig-out/lib/libzigcrypto";
32
27 var pzErrMsg: [*c]u8 = undefined; 33 var pzErrMsg: [*c]u8 = undefined;
28 const result = sqlite.c.sqlite3_load_extension(db.db, "./zig-out/lib/libzigcrypto", null, &pzErrMsg); 34 const result = sqlite.c.sqlite3_load_extension(db.db, extension_path, null, &pzErrMsg);
29 if (result != sqlite.c.SQLITE_OK) { 35 if (result != sqlite.c.SQLITE_OK) {
30 const err = sqlite.c.sqlite3_errstr(result); 36 const err = sqlite.c.sqlite3_errstr(result);
31 std.debug.panic("unable to load extension, err: {s}, err message: {s}\n", .{ err, std.mem.sliceTo(pzErrMsg, 0) }); 37 std.debug.panic("unable to load extension, err: {s}, err message: {s}\n", .{ err, std.mem.sliceTo(pzErrMsg, 0) });