Skip to content

Zig 0.16 Compatibility#34

Merged
mitchellh merged 5 commits into
mitchellh:mainfrom
francisqureshi:main
Apr 17, 2026
Merged

Zig 0.16 Compatibility#34
mitchellh merged 5 commits into
mitchellh:mainfrom
francisqureshi:main

Conversation

@francisqureshi
Copy link
Copy Markdown
Contributor

@francisqureshi francisqureshi commented Apr 12, 2026

I have been using zig-objc for my own Zig 0.16 projects for some time as I've wanted the newer Zig features. I saw that Ghostty looks to be getting ready for Zig 0.16 too, so here is my PR dealing with the following Zig 0.16 changes, I would suggest making a 0.16 branch for this to live on?

So the biggy is @type was removed in Zig 0.16. Zig type construction now uses the new dedicated builtins: @fn, @struct, @tuple, @int etc

Changes:

  • Migrate @type to 0.16 builtins (@fn, @struct, @tuple)
  • Replace std.io.Writer.Discarding with std.fmt.count
  • sliceTo(ptr, 0) → span(ptr) for sentinel-terminated C strings
  • Update build.zig for 0.16 API (root_module.link*, getSdk takes b.graph.Io)
  • Unwrap wrapper types (Object, Class, Sel) to C types for @fn callconv(.c) compatibility
  • Add comptime ABI validation in unwrapType
  • Add test for wrapper type args in msgSend

Bonus as its there...

When I was initially getting the 0.16 compatibility to work, I have used Claude Code via Sonnet and Opus 4.6 to do the bulk of the work, but I have since reviewed all the code and subsequently worked on it manually, exploring all the options around @type's removal.

@francisqureshi
Copy link
Copy Markdown
Contributor Author

*Further amended to use @Splat() after re-reading the 0.16 release notes 🙂

@mitchellh
Copy link
Copy Markdown
Owner

Failed tests for me because of this: https://codeberg.org/ziglang/zig/issues/31917

I'm trying to find a workaround.

@mitchellh mitchellh merged commit c8de82f into mitchellh:main Apr 17, 2026
1 check passed
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.

block.zig: descCopyHelper parameters are swapped.

2 participants