{"id":13739194,"url":"https://github.com/suirad/zig-header-gen","last_synced_at":"2026-04-07T14:31:26.701Z","repository":{"id":56555444,"uuid":"278492743","full_name":"suirad/zig-header-gen","owner":"suirad","description":"Automatically generate headers/bindings for other languages from Zig code ","archived":false,"fork":false,"pushed_at":"2023-01-11T02:13:18.000Z","size":80,"stargazers_count":81,"open_issues_count":4,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-19T10:49:33.532Z","etag":null,"topics":["binding-generator","build","c","comptime","cpp","golang","header-generator","nim","python","rust","zig","zig-library"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/suirad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-09T23:31:09.000Z","updated_at":"2025-06-06T15:39:56.000Z","dependencies_parsed_at":"2023-02-08T22:25:11.889Z","dependency_job_id":null,"html_url":"https://github.com/suirad/zig-header-gen","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/suirad/zig-header-gen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suirad%2Fzig-header-gen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suirad%2Fzig-header-gen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suirad%2Fzig-header-gen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suirad%2Fzig-header-gen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suirad","download_url":"https://codeload.github.com/suirad/zig-header-gen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suirad%2Fzig-header-gen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31515385,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["binding-generator","build","c","comptime","cpp","golang","header-generator","nim","python","rust","zig","zig-library"],"created_at":"2024-08-03T04:00:28.264Z","updated_at":"2026-04-07T14:31:26.680Z","avatar_url":"https://github.com/suirad.png","language":"Zig","readme":"# HeaderGen\r\n\r\n`HeaderGen` automatically generates headers/bindings for other languages given\r\n Zig code with exported functions/types\r\n\r\nHere are the following supported language binding outputs:\r\n\r\n- [x] C Bindings\r\n- [x] Python Bindings\r\n- [ ] Rust Bindings\r\n- [ ] Go Bindings\r\n- [ ] Nim Bindings\r\n\r\nHere are the following supported Zig language features:\r\n\r\n- [x] Extern Functions\r\n- [x] Extern Structs\r\n- [x] Extern Unions\r\n- [x] Extern Enums\r\n\r\n## Getting started\r\n\r\nGiven the following Zig code as the file `src/fancylib.zig` and using the C generator:\r\n\r\n```zig\r\nconst std = @import(\"std\");\r\n\r\nexport fn print_msg(msg_ptr: ?[*]const u8, len: usize) bool {\r\n    if (msg_ptr) |raw_msg| {\r\n        const msg = raw_msg[0 .. len - 1];\r\n        std.debug.print(\"Msg is: {}\", .{msg});\r\n        return true;\r\n    }\r\n    return false;\r\n}\r\n\r\nconst Internal = struct {\r\n    a: u64,\r\n};\r\n\r\nconst External = extern struct {\r\n    b: u64,\r\n    c: [100]u8,\r\n};\r\n\r\nexport fn use_internal_and_external(i: ?*Internal, e: ?*External) void {\r\n    // do things...\r\n}\r\n```\r\n\r\nYou will receive the following C header in `headers/fancylib.h`:\r\n\r\n```c\r\n#ifndef _fancylib_H\r\n\r\n#define _fancylib_H\r\n#include \u003cstddef.h\u003e\r\n#include \u003cstdint.h\u003e\r\n#include \u003cstdbool.h\u003e\r\n\r\ntypedef struct External {\r\n   uint64_t b;\r\n   uint8_t c[100];\r\n} External_t;\r\n\r\nbool print_msg(uint8_t* arg0, size_t arg1);\r\n\r\nvoid use_internal_and_external(void* arg0, External_t* arg1);\r\n\r\n\r\n#endif\r\n```\r\n\r\n## Usage Notes\r\n\r\n- Copy from this repo `header_gen.zig` and the folder `generators`;\r\n drop them next to your `build.zig`\r\n- See the `build.zig` in this repo for an example of integration\r\n\r\n","funding_links":[],"categories":["Development Tools","FFI Bindings"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuirad%2Fzig-header-gen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuirad%2Fzig-header-gen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuirad%2Fzig-header-gen/lists"}