All Projects → suirad → zig-header-gen

suirad / zig-header-gen

Licence: MIT license
Automatically generate headers/bindings for other languages from Zig code

Programming Languages

Zig
133 projects

Projects that are alternatives of or similar to zig-header-gen

get-cmake
Install and Cache latest CMake and ninja executables for your workflows on your GitHub
Stars: ✭ 52 (+30%)
Mutual labels:  build
micromamba-docker
Rapid builds of small Conda-based containers using micromamba.
Stars: ✭ 97 (+142.5%)
Mutual labels:  build
libgen
Automatic C-bindings generator for the Crystal language
Stars: ✭ 71 (+77.5%)
Mutual labels:  binding-generator
build verify
A Dart package to verify that the build is up-to-date with respect to a git repository
Stars: ✭ 28 (-30%)
Mutual labels:  build
k8s-knative-gitlab-harbor
Build container images with Knative + Gitlab + Harbor inside Kops cluster running on AWS
Stars: ✭ 23 (-42.5%)
Mutual labels:  build
autosetup
A better, faster autoconf replacement
Stars: ✭ 60 (+50%)
Mutual labels:  build
ios-build-action
Build iOS project (.xcodeproj, .xcworkspace), export .ipa, optional upload to BrowserStack App Live.
Stars: ✭ 73 (+82.5%)
Mutual labels:  build
wrenbind17
A header only library for binding C++17 classes and functions to Wren, an embeddable programming language
Stars: ✭ 44 (+10%)
Mutual labels:  binding-generator
icon-pipeline
🚚 SVG icon pipeline - Optimize icons & build SVG sprites
Stars: ✭ 43 (+7.5%)
Mutual labels:  build
AzDo.VstsDashboard
Provide a simple way to view all Builds and Releases on a single page. The intend was to see what's currently happened into the CI/CD pipeline and provide quick feedback of what's going on.
Stars: ✭ 16 (-60%)
Mutual labels:  build
xcodedevtools
Xcode Development Scripts
Stars: ✭ 44 (+10%)
Mutual labels:  build
zgt
Zig GUI Toolkit: Portable library for making native GUIs in Zig
Stars: ✭ 218 (+445%)
Mutual labels:  zig-library
build
Build system scripts based on GENie (https://github.com/bkaradzic/genie) project generator
Stars: ✭ 30 (-25%)
Mutual labels:  build
mix script
A build tool which allows you to use mix packages in an elixir script
Stars: ✭ 16 (-60%)
Mutual labels:  build
Carbon.Gulp
Carbon/Gulp is a delicious blend of tasks and build tools poured into Gulp to form a full-featured modern asset pipeline for Flow Framework and Neos CMS.
Stars: ✭ 15 (-62.5%)
Mutual labels:  build
ionic4-angular8-crud-mobileapps-example
Ionic 4 Angular 8 Tutorial: Learn to Build CRUD Mobile Apps
Stars: ✭ 20 (-50%)
Mutual labels:  build
ngp
New Go Package
Stars: ✭ 22 (-45%)
Mutual labels:  build
eslint4b
ESLint which works in browsers.
Stars: ✭ 33 (-17.5%)
Mutual labels:  build
pexample
Building and packaging Python with Pants and PEX - an annotated example
Stars: ✭ 21 (-47.5%)
Mutual labels:  build
wsjcpp
Yet another... C++ Source Package Manager
Stars: ✭ 18 (-55%)
Mutual labels:  build

HeaderGen

HeaderGen automatically generates headers/bindings for other languages given Zig code with exported functions/types

Here are the following supported language binding outputs:

  • C Bindings
  • Python Bindings
  • Rust Bindings
  • Go Bindings
  • Nim Bindings

Here are the following supported Zig language features:

  • Extern Functions
  • Extern Structs
  • Extern Unions
  • Extern Enums

Getting started

Given the following Zig code as the file src/fancylib.zig and using the C generator:

const std = @import("std");

export fn print_msg(msg_ptr: ?[*]const u8, len: usize) bool {
    if (msg_ptr) |raw_msg| {
        const msg = raw_msg[0 .. len - 1];
        std.debug.warn("Msg is: {}", .{msg});
        return true;
    }
    return false;
}

const Internal = struct {
    a: u64,
};

const External = extern struct {
    b: u64,
    c: [100]u8,
};

export fn use_internal_and_external(i: ?*Internal, e: ?*External) void {
    // do things...
}

You will receive the following C header in headers/fancylib.h:

#ifndef _fancylib_H

#define _fancylib_H
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>

typedef struct External {
   uint64_t b;
   uint8_t c[100];
} External_t;

bool print_msg(uint8_t* arg0, size_t arg1);

void use_internal_and_external(void* arg0, External_t* arg1);


#endif

Usage Notes

  • Copy from this repo header_gen.zig and the folder generators; drop them next to your build.zig
  • See the build.zig in this repo for an example of integration
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].