New to Zig? We recommend checking out ziglang.org/learn to get up to speed.

Local development

To run the code for your challenge locally, you’ll need zig installed. Our test runners use version 0.11 (as of November 2023).

The script for your challenge (like ./your_bittorrent.sh) will automatically compile your code using zig build-exe before executing it. It’ll look something like this:

#!/bin/sh
set -e

zig build-exe ./app/main.zig
exec ./main "$@"

File structure

  • The files for your solution are placed in the app directory.
  • app/main.zig contains the main function, which is what the test runner executes.

Adding more files

You can add more files and directories to the app directory. The test runner will include them when compiling your code.

For example, if you added a file at app/foo.zig, you could use it like so:

You can also add files in subdirectories. For example, if you added a file at app/foo/bar.zig, you could use it like so:

Adding dependencies

We don’t support the package manager added in Zig 0.11 yet. For now, you’ll need to copy in any dependencies you need into your project and import them using @import.

We’d love help adding support for the new package manager added in Zig 0.11. If you’re interested in this, feel free to open a PR to the SQLite challenge repository. You can find more details on contributing language support here.