Started writing Zig and couldn’t find a GUI library I liked. Before I noticed Knots (which looks really nifty), I saw that Slint provides a C++ ABI but no one wrote Zig bindings (that I could find).
slint-zig has various examples, they all work on macOS and GNU/Linux. There’s a long list of things to do to make the code less crappy and perform better (patches welcome!), but it seems to be okay. I’m hoping it matures enough that I could submit to Slint as official bindings for Zig.
If anyone has Windows, that would be great to test it there.
Let me know if you find it useful, so I know there’s someone who will benefit from me cleaning up and improving things 
10 Likes
I was just about to test it on Windows but realised the script for building slint is a bash script and I’m not very keen on using WSL. But regardless, why exactly is a build script needed? It feels quite anti-Zig (Zag if you will) to need to run bash scripts to use a Zig dependency
, I saw that Slint provides pre-built dlls (rather annoyingly with an installer on Windows), but I would much rather have a build option like -Dslint_path than having to clone slint, and run that script. I think it would also alleviate controlling which version of Slint the bindings support. Also, these few lines
// surface a clear error when the slint install is missing, instead
// of letting the c++ compile fail with a cryptic "slint-interpreter.h
// not found". the build runs on a hosted system, so std.c.access is
// fine here.
const header_path = b.pathJoin(&.{ slint_include, "slint-interpreter.h" });
const header_z = b.allocator.dupeZ(u8, header_path) catch @panic("oom");
if (std.c.access(header_z.ptr, 0) != 0) {
caused me to error with “dependency on libc must be explicitly specified in the build command” on Windows.
Thank you for looking into it!
The script is to help any developer of slint-zig using Unix-like OS who doesn’t want to remember how to build Slint from scratch - i.e., me.
It’s not required and you don’t need to use it.
The default in build.zig to use ./.slint-install as the slint installation default is not “production-ready” but it made my life developing this much easier (much like the script).
So there’s definitely edges that need smoothing, but admittedly those were more for my convenience.
I would appreciate any PRs to help it work on Windows properly, to smooth the rough edges, or to improve the Zig code in it. By all means!
Thanks. 
1 Like