summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/zigcrypto_test.zig10
1 files changed, 8 insertions, 2 deletions
diff --git a/examples/zigcrypto_test.zig b/examples/zigcrypto_test.zig
index 69a30bc..9340f99 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,11 +25,16 @@ 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 at path {s}, err: {s}, err message: {s}\n", .{ extension_path, err, std.mem.sliceTo(pzErrMsg, 0) });
32 } 38 }
33 } 39 }
34 40