Zig and GTK4 with GObject?


I’m currently learning how to build GTK4 applications using Zig. Since Zig can directly use C libraries, I’ve experimented with that, making a simple Hello World.

However, I see that GObject seems to be an unavoidable component of any big GTK applications, at least when using C.

I’ve looked around for GTK4 applications made in Zig, but so far it seems that there’s only small projects that can get around using GObject.

I would like to know if anybody here have experimented with Zig and GTK4; if they have used GObject with Zig as well (and how); and supposedly how much can you build a GTK4 application in Zig, without having to use GObject.

Best regards.

It is probably pretty limited as GObject allows accessing Properties, Signals and the type system in general.

I don’t know Zig but in general it is probably a good idea to use some language binding as those make it easier to use the libraries.

1 Like

This sounds like an XY problem. Why do you want to avoid using GObject in the first place?

1 Like

I once came across a couple (limited) attempts at GObject-Introspection bindings for Zig here and here respectively.

I also have a passing interest in Zig for this purpose, however avoiding GObject is basically a no-go, as it’s quite foundational to the whole platform. I know very little of Zig, but in principle I don’t see why it couldn’t be bound to GLib & friends in the same way as Rust.

EDIT: GitHub - DerryAlex/zig-gir-ffi: GObject Introspection for zig looks a little more active

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.