diff options
| author | 2024-04-14 19:09:23 +0200 | |
|---|---|---|
| committer | 2024-04-14 19:31:53 +0200 | |
| commit | 9f0d2ed11dacbade3343cbe49e8f159f1d8b67f5 (patch) | |
| tree | 61113afc3f62d456b6da480e3bd7ae9a7907e936 /c/workaround.c | |
| parent | ci: reenable windows (diff) | |
| download | zig-sqlite-9f0d2ed11dacbade3343cbe49e8f159f1d8b67f5.tar.gz zig-sqlite-9f0d2ed11dacbade3343cbe49e8f159f1d8b67f5.tar.xz zig-sqlite-9f0d2ed11dacbade3343cbe49e8f159f1d8b67f5.zip | |
c: add a workaround for SQLITE_TRANSIENT being mistranslated
See https://github.com/ziglang/zig/issues/15893
zig's translate-c creates an invalid type for SQLITE_TRANSIENT on some
architectures (aarch64, riscv64 and others).
We can work around this by making a C function that returns -1 cast to
the proper destructor type and use that from zig (thanks
https://github.com/Cloudef for mentioning this in this comment: https://github.com/ziglang/zig/issues/15893#issuecomment-1925092582)
Diffstat (limited to 'c/workaround.c')
| -rw-r--r-- | c/workaround.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/c/workaround.c b/c/workaround.c new file mode 100644 index 0000000..592d33d --- /dev/null +++ b/c/workaround.c | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | #include "workaround.h" | ||
| 2 | |||
| 3 | my_sqlite3_destructor_type sqliteTransientAsDestructor() { | ||
| 4 | return (my_sqlite3_destructor_type)-1; | ||
| 5 | } | ||