c.zig (1038B) - Raw
1 //! This is Zig's multi-target implementation of libc. 2 //! 3 //! When `builtin.link_libc` is true, we need to export all the functions and 4 //! provide a libc API compatible with the target (e.g. musl, wasi-libc, ...). 5 6 const builtin = @import("builtin"); 7 const std = @import("std"); 8 9 // Avoid dragging in the runtime safety mechanisms into this .o file, unless 10 // we're trying to test zigc. 11 pub const panic = if (builtin.is_test) 12 std.debug.FullPanic(std.debug.defaultPanic) 13 else 14 std.debug.no_panic; 15 16 comptime { 17 _ = @import("c/inttypes.zig"); 18 _ = @import("c/stdlib.zig"); 19 20 if (builtin.target.isMuslLibC() or builtin.target.isWasiLibC()) { 21 // Files specific to musl and wasi-libc. 22 _ = @import("c/string.zig"); 23 _ = @import("c/strings.zig"); 24 } 25 26 if (builtin.target.isMuslLibC()) { 27 // Files specific to musl. 28 } 29 30 if (builtin.target.isWasiLibC()) { 31 // Files specific to wasi-libc. 32 } 33 34 if (builtin.target.isMinGW()) { 35 // Files specific to MinGW-w64. 36 } 37 }