kassane/c2z — explained in plain English
Analysis updated 2026-07-18 · repo last pushed 2024-11-04
Generate Zig bindings for an existing C++ library like imgui, box2d, raylib, or SDL2.
Bridge a C++ codebase into a Zig project without manually writing FFI glue.
Prototype Zig interop for a 'C with classes' style C++ library.
Save boilerplate when wrapping C++ headers, then hand-fix the generated bindings.
| kassane/c2z | achanana/mavsdk | alange/llama.cpp | |
|---|---|---|---|
| Stars | — | — | 0 |
| Language | C++ | C++ | C++ |
| Last pushed | 2024-11-04 | 2024-05-20 | — |
| Maintenance | Stale | Dormant | — |
| Setup difficulty | moderate | moderate | moderate |
| Complexity | 4/5 | 4/5 | 4/5 |
| Audience | developer | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
Generated bindings often need manual fixes, works best on 'C with classes' style C++, not heavy templates.
c2z is a tool that automatically translates C++ code into Zig code. If you have a C++ library you want to use from Zig, this tool reads the C++ headers and generates Zig bindings, the glue code that lets Zig call into the original C++ functions and use its types. It is essentially an automated bridge between two programming languages. The way it works under the hood is clever: it uses Zig's own built-in C/C++ compiler (which is based on Clang) to analyze the C++ source code and produce a JSON description of its structure. Then c2z reads that JSON and writes out the equivalent Zig code. You run it on a header file and it spits out a Zig file you can import. You can also pass standard compiler flags to it, like include paths and target platforms. The main audience is Zig developers who want to use existing C++ libraries without rewriting them by hand. The project lists several test cases, libraries like imgui, box2d, raylib, and SDL2, and reports partial success rates, ranging from around 67% to nearly 100% of the code translated automatically. This gives you a sense of where it stands: it handles a good chunk of the work but is not a finished, one-click solution. The README is candid about the limitations. Generated code can leak memory because C++ implicit destructors are not called. Manual adjustments are expected, you generate the bindings and then clean them up by hand until they work. The tool is designed for libraries written in a "C with classes" style rather than heavily template-driven C++. There is secondary support for MSVC on Windows but it comes with caveats around debug builds. This is clearly an experimental project still in progress. The todo list is long and includes both easy polish items and hard problems like converting #include directives to Zig imports and handling variadic functions. If you are working in Zig and need C++ interop, it could save you significant boilerplate, but you should expect to finish the job yourself.
c2z automatically translates C++ headers into Zig bindings, letting Zig developers call existing C++ libraries without hand-writing glue code.
Mainly C++. The stack also includes Zig, C++, Clang.
Stale — no commits in 1-2 years (last push 2024-11-04).
The README doesn't specify license details.
Setup difficulty is rated moderate, with roughly 1h+ to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Don't trust strangers blindly. Verify against the repo.