Re:C Macro Reflection in Zig – Zig Has Better C Interop Than...
by throwawaymaths on Tuesday July 30, 2024 @12:26PM
(#41110936)
I don't think that's the case. In general you can set up @import modules from the command line, and I'm not 100% sure but I think build.zig generally just templates a command line call anyways.
[ Parent
| on HN ]
Re:C Macro Reflection in Zig – Zig Has Better C Interop Than...
by kbolino on Tuesday July 30, 2024 @12:48PM
(#41111251)
I don't think this DSL is finalized yet, but you can see on a linked issue what the build.zig to support @import of C looks like on nightly:
const translate_c = b.addTranslateC(.{
.root_source_file = b.path("src/c.h"),
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("c", translate_c.createModule());
https://github.com/ziglang/zig/issues/20648