Skip to content

Zig 0.17: translate the C API with the translate-c package; CI on 0.17.0 - #1

Open
xuckless wants to merge 2 commits into
Greebling:zig-0.17.0from
xuckless:zig-0.17-fixes
Open

xuckless wants to merge 2 commits into
Greebling:zig-0.17.0from
xuckless:zig-0.17-fixes

Conversation

@xuckless

Copy link
Copy Markdown

Two small changes on top of this branch, to help vrischmann#215 land:

  • build: the translate-c package instead of std.Build.addTranslateC, which is deprecated in 0.17 and slated for removal. It is pinned to the package's zig-0.17.x branch. It needs .default_init = true so struct literals keep zero defaults as with @cImport; without it, vtab.zig's sqlite3_module literal fails on xIntegrity (added in SQLite 3.44).
  • ci: test with Zig 0.17.0; the workflow was still on 0.16.0, where this branch can't build.

Tested: the full test suite passes on Zig 0.17.0 (55/55) on macOS arm64 and aarch64 Linux, in-memory and file mode. It also compiles for x86_64/x86 musl, x86_64-windows and x86_64-macos.

std.Build.addTranslateC is deprecated in Zig 0.17 and goes away in 0.18;
the translate-c package (branch zig-0.17.x) is its replacement. Its
struct fields are not default-initialised unless asked, so default_init
keeps struct literals such as vtab.zig's sqlite3_module compiling against
SQLite versions that add fields (xIntegrity in 3.44).
@Greebling

Copy link
Copy Markdown
Owner

Good catch with the ci workflow!
I used zigs translateC package because it would add the least amount of dependencies for now. Personally, I do prefer to use the existing external package, though. I am not sure when the original maintainer will respond to my PR so I am inclined to accept yours and add translateC as dependency. However, I do prefer to point to a concrete commit of a repository, since future updates could in theory break or bring up hidden bugs. Could you point at the latest commit of the branch instead? Right now that would be #cfac21f3199b2b02ce3fd7db652aa456421fe4ab

Thanks for your contribution!

@Greebling
Greebling self-requested a review October 22, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants