{"id":18442531,"url":"https://github.com/donsez/zig-examples","last_synced_at":"2025-04-14T19:17:59.878Z","repository":{"id":77598429,"uuid":"392971536","full_name":"donsez/zig-examples","owner":"donsez","description":"Ziglang examples","archived":false,"fork":false,"pushed_at":"2021-11-22T19:51:14.000Z","size":5,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T19:17:56.175Z","etag":null,"topics":["zig"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/donsez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-05T08:50:56.000Z","updated_at":"2024-07-30T16:02:29.000Z","dependencies_parsed_at":"2023-02-26T18:30:40.379Z","dependency_job_id":null,"html_url":"https://github.com/donsez/zig-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donsez%2Fzig-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donsez%2Fzig-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donsez%2Fzig-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donsez%2Fzig-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/donsez","download_url":"https://codeload.github.com/donsez/zig-examples/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248943463,"owners_count":21186958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["zig"],"created_at":"2024-11-06T06:42:39.839Z","updated_at":"2025-04-14T19:17:59.848Z","avatar_url":"https://github.com/donsez.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zig :: Examples\n\nZig is a general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.\n\nhttps://ziglang.org/\n\nhttps://ziglang.org/documentation/master/#Introduction\n\n## Installation\n\n###  Tarball\n```bash\ncd ~/devtools\nwget https://ziglang.org/builds/zig-macos-x86_64-0.9.0-dev.729+bd8baefaa.tar.xz\nxz -d zig-macos-x86_64-0.9.0-dev.729+bd8baefaa.tar.xz\nPATH=$PATH:~/devtools/zig-macos-x86_64-0.9.0-dev.729+bd8baefaa\nzig env\n```\n### Brew\n\n```bash\nbrew install zig\n```\n\nFrom Git HEAD\n```bash\nbrew install zig --HEAD\n```\n\n## Examples\n\n### Hello World !\n\n```bash\ncd hello\nzig build-exe hello.zig\nwc -c hello\n./hello\n\nzig build-exe hello.zig -O ReleaseSmall --strip --single-threaded\nwc -c hello\nzig build-exe hello.zig -O ReleaseSmall --strip --single-threaded -target x86_64-macos\nwc -c hello\nfile hello\n```\n\n### Global variables\n\n```bash\ncd  global_variables\nzig test global_variables.zig\n```\n\n### Errors\n\nTODO\n\n### Test\n\n```bash\ncd test_null\nzig test test_null.zig\n```\n\n### C library (libcurl)\n\n```bash\ncd curl\nzig build-exe curl.zig \n```\n\n\u003e See https://ziglearn.org/chapter-4/\n\n### Config\n\n```bash\ncd config/\nzig build-exe config.zig \n./config \n```\n\n### Comptime\n\nTODO\n\n### Async\n\nTODO\n\n\u003e See https://ziglearn.org/chapter-5/\n\n### Allocator\n\nTODO\n\n\u003e See https://ziglearn.org/chapter-2/#allocators\n\n### Cross compile\n\n```bash\ncd cross-compile-arm/\nzig targets\nzig targets | jq .arch\nzig targets | jq .os\nzig targets | jq .abi\nzig targets | jq .libc\n\nzig build-exe hello.zig -target armeb-linux-musleabi --library c --strip --single-threaded\nfile hello\n```\n\n\u003e See https://ziglearn.org/chapter-3/#cross-compilation\n\n\n### Benchmarks\n```bash\ncd benchmark/\n./benchmark.sh\n```\n\n\u003e See https://github.com/Sahnvour/zig-benchmark\n\u003e See https://benchmarksgame-team.pages.debian.net/benchmarksgame/why-measure-toy-benchmark-programs.html\n\u003e See https://github.com/tiehuis/zig-benchmarks-game\n\n## Resources\n\n* https://ziglearn.org/\n* https://github.com/ziglang/zig/tree/master/test\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdonsez%2Fzig-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdonsez%2Fzig-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdonsez%2Fzig-examples/lists"}