0.16.0 Released

E.g.:

const c = b.addTranslateC(.{
    .root_source_file = b.path("src/c.c"),
    .link_libc = true,
    .target = target,
    .optimize = optimize,
});

const exe = b.addExecutable(.{
    .name = "my-program",
    .root_module = b.createModule(.{
        .root_source_file = b.path("src/root.zig"),
        .target = target,
        .optimize = optimize,
        .imports = &.{
            .{ .name = "c", .module = c.createModule() },
        },
    }),
});

Then you do const c = @import("c"); wherever you want to use the translated headers.

2 Likes