test.h
enum CXCursorKind {
CXCursor_UnexposedDecl = 1,
CXCursor_StructDecl = 2,
};
main.zig:
const std = @import("std");
const c = @cImport({
@cInclude("test.h");
});
pub fn main() !void {
std.debug.print(
"TypeName(c.CXCursorKind): {s}\n",
.{@typeName(c.CXCursorKind)},
);
}
zig build run
results: TypeName(c.CXCursorKind): c_uint
zig build run -Dtarget=x86_64-windows-msvc
results: TypeName(c.CXCursorKind): c_int
the variants all result in c_int
type for both abis. so it’s kind of an issue if gnu abi sets the enum type(s) as c_uint
, can’t directly pass the variants to the functions which accepts the enum without @intCast
and it’s kinda annoying.