Zig Programming Language
Created:
[TOC]
The Zig Programming Language is an open-source programming language designed for robustness, optimality, and clarity.
Introduction
- Introduction to the Zig Programming Language - Andrew Kelley
- zig in 30 minutes; HN; Jan 2021.
- Learning Zig by Karl Seguin.
Code
- andrewrk/tetris: A simple tetris clone written in zig programming language.
- Hejsil/pokemon-randomizer: A Pokémon Rom randomizer tool written in Zig
- dbandstra / oxid · GitLab
Articles
- Porting Zig to NetBSD - a fun, speedy port
- Iterative Replacement of C with Zig
- How Zig Do?
- Zig Learn
- Zig – Mitchell Hashimoto and writing
- Zig
And Rust by Alex Kladov/
matklad
- Zig Quirks
- Ziggifying Kilo; Apr 2023.
- When Zig is safer and faster than Rust; Mar 2023.
- Problems of C, and how Zig addresses them; Jun 2023.
Project Management
FFI
- Andrew K: Friendly challenge for Go programmers:
Provide or link to a small (50-200 ish lines) idiomatic Go program demonstrating concurrency. (Elegant use of goroutines, channels, etc)
I’ll provide the equivalent Zig program using
async/await
andstd.event.Loop
for comparison.
My notes
Cross compiling zig
Code
# crosscompile.zig
const warn = @import("std").debug.warn;
pub fn main() void {
warn("Hello, world!\n");
}
Compiling natively on Mac OSX
$ zig build-exe crosscompile.zig
$ file crosscompile
crosscompile: Mach-O 64-bit executable x86_64
Cross-compiling for Linux
The C ABI tuple of (operating system, architecture, C compiler
environment) is defined by
--target-os --target-arch --target-environ
flags of zig.
[ref]
zig build-exe crosscompile.zig --target-os linux --target-arch x86_64
Verify the executable file type created:
$ file crosscompile
crosscompile: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, with debug_info, not stripped