zig/test/standalone/hello_world/hello_libc.zig

14 lines
343 B
Zig
Raw Normal View History

const c = @cImport({
// See https://github.com/ziglang/zig/issues/515
2017-10-01 18:05:08 -07:00
@cDefine("_NO_CRT_STDIO_INLINE", "1");
@cInclude("stdio.h");
@cInclude("string.h");
});
const msg = "Hello, world!\n";
2019-12-01 01:31:18 -08:00
pub export fn main(argc: c_int, argv: **u8) c_int {
if (c.printf(msg) != @intCast(c_int, c.strlen(msg))) return -1;
return 0;
}