Skip to content

Zig 0.16 Compatibility#34

Open
francisqureshi wants to merge 2 commits intomitchellh:mainfrom
francisqureshi:main
Open

Zig 0.16 Compatibility#34
francisqureshi wants to merge 2 commits intomitchellh:mainfrom
francisqureshi:main

Conversation

@francisqureshi
Copy link
Copy Markdown

@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.

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.

1 participant