Can anyone point me to a working example of this feature?
I just can’t seem to get it to work:
install
└─ install test
└─ compile exe test Debug native 1 errors
src/test.c:2:10: error: 'base64.h' file not found
#include "base64.h"
edit:
Here is my implementation
https://codeberg.org/usebeforefree/mixing-object-files-example
I can reproduce it.
I’ve tried adding:
exe.root_module.addCSourceFile(.{ .file = b.path("src/test.c"), .flags = &.{"-std=c99"} });
exe.root_module.addObject(obj);
+ exe.root_module.addIncludePath(obj.getEmittedH().dirname());
b.installArtifact(exe);
Which outputs:
error: -femit-h is currently broken, see https://github.com/ziglang/zig/issues/9698
So it looks like the header generation is not working.
1 Like
Currently you must provide a prototype declaration for the zig function:
#include <string.h>
#include <stdio.h>
extern size_t decode_base_64(char *, size_t, const char *, size_t);
int main(int argc, char **argv)
{
...
2 Likes