Are there any public projects which use a zig module via a C interface? I know about zig build addStaticLibrary to build from the zig side, but I’m interested in the rest of the build system, in particular how a C or C++ project builds and consumes a Zig module. It would be educational to see how others have approached this.
I am not aware of any projects, but there are libraries for using zig instead of C for extensions (python modules, ruby extensions, erlang/elixir nifs).
See also Extend a C/C++ Project with Zig where Loris Cro extends redis by commands implemented in zig.
I like the use of Zig build to replace the C build system in that series, but I’m specifically looking for the inverse – how to supply a zig library to an existing (probably cmake) build system. It’s not complicated, just need to call out to zig to create the artifact and link it in, but I always learn something from looking at others’ work.
I have in my head “Zig is better at C than C” but I’m looking for that step which allows incrementally introducing zig to a C/C++ project without taking over the build system first.