When using @cImport(@cInclude("some_file.h"))
I’m getting multiple definitions of the same struct depending on how I declare it. I ran a search for @cImport
through the github issues, but I didn’t see an issue relating to this (maybe I missed it?).
For reference, I am using ZLS
.
Here’s an example header (we’ll call it head.h
):
struct c32 { float r; float i; };
If I now include this like so…
const decls = @cImport(
@cInclude("path/to/head.h")
);
I see two constants:
decls.struct_c32
decls.c32
But if I declare c32
in head.h
like so…
typedef struct { float r; float i; } c32;
After reloading my Helix
editor, I only get:
decls.c32
So I’m of course curious - is this an issue with how Zig imports C files, or is this a ZLS
issue? I’m leaning towards just using typedef
to cut down on the white noise.
Thanks