Skip to content
@z-libs

z-libs

z-libs: Building the Future of C

Sponsor Discord

Home of the Zen C programming language.

z-libs is an organization dedicated to modernizing systems programming. We believe C is the perfect foundation, but it needs modern ergonomics. Whether through our compiled language Zen C or our classic header-only libraries, our mission is the same:
Zero Overhead. Maximum Productivity.


Zen C

Zen C is a compiled systems language that seamlessly extends C11. It isn't just a wrapper; it's a full language toolchain designed to make C development joyful again.

Why Zen C?

  • Modern Syntax: Type inference (let), Pattern Matching (match), and Traits (impl).
  • Zero cost: Compiles to standard, human-readable C11. No heavy runtime.
  • Memory Safety Options: Manual memory management with defer, autofree, and strict Move Semantics by default.
  • Universal Binaries: Compiles to APE (Actually Portable Executable) format—build once, run anywhere.
  • Seamless Interop:
    • C++ Mode: Compiles to C++ to use libraries like <vector> or OpenCV.
    • CUDA Support: Write GPU kernels directly in Zen C syntax.
    • Objective-C linkage: Build native macOS apps with Cocoa.
import "std/vec.zc"
import "std/net.zc"

struct User { id: int; name: string; }

async fn fetch_user(id: int) -> User {
    // Async/Await syntax built on native pthreads/coroutines
    return User{id: id, name: "Alice"};
}

fn main() {
    let users = Vec<User>::new();
    
    match fetch_user(101) |> await {
        User(id, name) => println "Got user: {name}", // Pattern destructuring
        _              => println "Failed"
    }
}

Classic C Libraries (z-libs)

Before Zen C, we built the z-libs suite: a collection of single-header C11 libraries that bring C++ container convenience to pure C. These are stable, battle-tested, and fully interoperable.

Library Description Features Status
zvec Type-safe dynamic arrays Full C++ Wrapper Stable
zstr SSO-optimized strings & views C++ Wrapper, Lua Bindings Stable
zmap Open-addressing hash maps Full C++ Wrapper Stable
zlist Doubly-linked lists Full C++ Wrapper Stable
zalloc Arenas, Pools, and Leak Detection Zero-overhead, Cache-friendly Stable

The "Bridge" Philosophy

Most libraries force you to choose a side. z-libs lets you cross the border freely.

1. Works perfectly in C11

Full control, no hidden allocations, type-safe macros.

// zvec: Dynamic Arrays
vec(int) scores = vec_init(int);
vec_push(&scores, 10);

2. And the SAME headers work natively in C++

RAII, methods, iterators, and std:: compatibility.

// z_vec: Wrapper around vec_int
z_vec::vector<int> scores = {10, 42};

3. Scripting Ready (Lua)

High-performance mutable buffers for scripts to avoid garbage collection churn.

local zstr = require("zstr")
local buf = zstr.new("Start: ")
Click to see more reasons "Why z-libs?"

Most C container libraries suffer from Macro Hell (cryptic errors), void* soup (no type safety), or Build System Fatigue (requiring CMake/Make just to use a vector).

z-libs solves this by using modern C11 features (_Generic) for the implementation while providing a "feels-like-native" C++ layer on top.

  • Zero external dependencies: Standard C library only.
  • Truly single-header: Just drop the file in your project.
  • Allocator-aware: Use zalloc.h (arenas, pools) or your custom heaps.
  • Universal: Compiles on GCC, Clang, MSVC, and tiny microcontrollers.

The Zen Ecosystem

It's not just a language; it's a complete toolkit.

  • LSP (Language Server): Go-to-definition, hover docs, and autocompletion for VS Code / Neovim.
  • REPL: Interactive shell for rapid prototyping and testing.
  • Build System: Zero-config compilation. Just zc run main.zc.

Meet Zibi

Zibi the Ogre

Zibi is the tiny green ogre that guards your memory.
He started life as a random GitHub identicon, reminded us of an ogre, and became the official mascot.

Zibi Likes Zibi Hates
Zen C (obviously) void* casting
Single-header libraries Segfaults
Stack allocation (SSO) Garbage Collection pauses
Onions (layers!) Complex build scripts

If your code compiles and runs on the first try, Zibi is happy.

License

All projects under z-libs use the MIT License. Free to use, modify, and distribute for personal and commercial projects.

Pinned Loading

  1. zvec.h zvec.h Public

    A type-safe, header-only generic vector library for C/C++ using X-Macros.

    C++ 42 3

  2. zlist.h zlist.h Public

    A type-safe, header-only generic doubly linked list library for C/C++ using X-Macros.

    C++ 30 4

  3. zstr.h zstr.h Public

    A modern, header-only string library for C/C++ using Small String Optimization (SSO) and Views.

    C 27 6

  4. zmap.h zmap.h Public

    A type-safe, header-only generic map library for C/C++ using X-Macros.

    C 31 3

  5. zrand.h zrand.h Public

    A statistically robust, header-only PCG random number library for C/C++.

    C++ 6

  6. Zen-C Zen-C Public

    Write like a high-level language, run like C.

    C 3.6k 166

Repositories

Showing 10 of 20 repositories
  • Zen-C-Docs Public
    z-libs/Zen-C-Docs’s past year of commit activity
    HTML 7 0 0 0 Updated Feb 1, 2026
  • Zen-C Public

    Write like a high-level language, run like C.

    z-libs/Zen-C’s past year of commit activity
    C 3,643 MIT 166 14 14 Updated Feb 1, 2026
  • zmap.h Public

    A type-safe, header-only generic map library for C/C++ using X-Macros.

    z-libs/zmap.h’s past year of commit activity
    C 31 MIT 3 0 0 Updated Feb 1, 2026
  • .github Public
    z-libs/.github’s past year of commit activity
    2 0 0 0 Updated Jan 31, 2026
  • zstr.h Public

    A modern, header-only string library for C/C++ using Small String Optimization (SSO) and Views.

    z-libs/zstr.h’s past year of commit activity
    C 27 MIT 6 0 1 Updated Jan 30, 2026
  • zdk Public

    The Zen Development Kit

    z-libs/zdk’s past year of commit activity
    C++ 58 MIT 3 0 0 Updated Dec 22, 2025
  • zerror.h Public

    A zero-dependency, header-only error handling library for C/C++ implementing robust Result types and automatic stack tracing.

    z-libs/zerror.h’s past year of commit activity
    C++ 3 MIT 1 0 0 Updated Dec 22, 2025
  • ztime.h Public
    z-libs/ztime.h’s past year of commit activity
    C 3 MIT 0 0 0 Updated Dec 22, 2025
  • zvec.h Public

    A type-safe, header-only generic vector library for C/C++ using X-Macros.

    z-libs/zvec.h’s past year of commit activity
    C++ 42 MIT 3 0 0 Updated Dec 22, 2025
  • ztree.h Public

    A type-safe, header-only generic Red-Black tree library for C/C++ using X-Macros.

    z-libs/ztree.h’s past year of commit activity
    C++ 1 MIT 0 0 0 Updated Dec 22, 2025

Top languages

Loading…

Most used topics

Loading…