here you goThings I’ve made, read and saved — shared here.

Zig Programming Language

On this page
  1. Introduction
  2. Code
  3. Learning
  4. Articles
  5. Project Management
  6. FFI
  7. Twitter
  8. My notes
  9. Cross compiling zig
  10. Software written in Zig

The Zig Programming Language is an open-source programming language designed for robustness, optimality, and clarity.

Introduction

Code

Learning

Articles

Project Management

FFI

Twitter

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 and std.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

Software written in Zig

More on