2026-05-12 23:10:12 +02:00
2026-03-06 13:17:27 +01:00
2026-05-12 23:10:12 +02:00
2025-10-05 00:22:36 +02:00
2026-03-13 14:44:41 +01:00

Building my own castle

I'm building my own castle in Zig .

This is a collection of experimental, recreational or actually useful libraries, which I may or may not use as a part of some other projects. Most of them are work in progress and might remain so indefinitely.

cjit

JIT compiler for the C language inspired by Fabrice Bellard's Tiny C Compiler (TCC). Meant to compile x86_64 and aarch64 for Windows and Linux straight to virtual memory, without the ability to output an executable file or library. C standard library is not fully supported, only some includes and builtins (see src/includes).

It's in very early stage and cannot be used as of now. Currently, parts of the tokenizer, x86_64 emit code and relocation logic are implemented. Aarch64 would come after x86_64 is fully implemented and actually works.

You can see an example of how this library is supposed to be used in test/root.zig.

js

Zig bindings for Fabrice Bellard's QuickJS. Original C sources are included and compiled with Zig's build system. The bindings are not complete, but usable.

media

Set of utilities for decoding and encoding media files. As of now, no purely Zig decoder/encoder exists, which would be the goal. There is fairly comprehensive PNG chunk decoder, though.

Bindings for stb_image.h from Sean T. Barrett's single-file C libraries are included. They can be used to decode PNG, JPEG and HDR images and support Zig's allocator interface in a thread-safe manner.

This package is actually used by my other project, codenamed voxel-game.

myid

Remnants of a project meant to provide a simpler alternative to OpenID Connect (OIDC). It contains an HTTP server, which has since been improved and resides in web package.

The ideas behind myid were developed further in another project I created using TypeScript and Bun as a runtime. I might backport them back to Zig when I find the time and motivation, which would be implemented on top of the HTTP server from the web package.

vecmath

Vector math library with support for vectors, matrices and ×8 SIMD operations (utilizing SOA layout).

This package is actually used by my other project, codenamed voxel-game and is probably the most complete package in this repository.

web

An HTTP server library and collection of other utilities commonly associated with web technologies.

The HTTP server implements HTTP version 1.1 using worker threads and supports SSL via OpenSSL library. The server is very low level and does not provide any logic to handle proper HTTP semantics. It is up to the user of the HTTP server library to respect (or not) all HTTP methods and headers. The server is designed or Linux only and uses Linux syscalls directly in its implementation.

The other utilities include:

  • HTTP/1.1 request parser, which is part of the HTTP server, but can be used independently,
  • OpenSSL bindings, which are used by the HTTP server, but can be used independently (full mechanical C translation is provided and partial manual Zig translation),
  • UUID type and generators for v4, v5 and v7,
  • Generic ID type, a wrapper around UUID (or anything that is 16 bytes long) that can be instantiated for each distinct use of ID with a tag to help avoid type confusion at compile time.

x11

Zig bindings for Xlib (aka libX11), a C library implementing a client of the X Window System protocol. The bindings are not complete.

Description
My programming castle
Readme 106 MiB
Languages
Zig 90.6%
C 9.4%