Reproducing an unexpected behavior in zig. The current state prints
COLORS: 0
If line 8 in main.zig is commented in, it prints
COLORS: 256
Tested in iTerm2 on macOS 10.15.4.
zig build-exe --library ncurses main.zig && ./main |
const std = @import("std"); | |
pub const c = @cImport({ | |
@cInclude("ncurses.h"); | |
}); | |
pub var COLORS: ?i32 = null; | |
pub fn start_color() void { | |
_ = c.start_color(); | |
COLORS = c.COLORS; | |
} |
const std = @import("std"); | |
const nc = @import("import.zig"); | |
const c = nc.c; | |
pub fn main() !void { | |
_ = c.initscr(); | |
nc.start_color(); | |
// const pCLRS = &c.COLORS; | |
if (nc.COLORS) |clrs| { | |
std.debug.warn("COLORS: {}\n", .{clrs}); | |
} | |
std.time.sleep(1000000000); | |
} |