Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

requiresLibC

Does this target require linking libc? This may be the case if the target has an unstable syscall interface, for example.

Target.requiresLibC
pub fn requiresLibC(target: *const Target) bool

File

lib/std/Target.zig:2230

Code

pub fn requiresLibC(target: *const Target) bool {
    return switch (target.os.tag) {
        .illumos,
        .driverkit,
        .ios,
        .maccatalyst,
        .macos,
        .tvos,
        .watchos,
        .visionos,
        .dragonfly,
        .haiku,
        .serenity,
        => true,

        // Android API levels prior to 29 did not have native TLS support. For these API levels, TLS
        // is implemented through calls to `__emutls_get_address`. We provide this function in
        // compiler-rt, but it's implemented by way of `pthread_key_create` et al, so linking libc
        // is required.
        .linux => target.abi.isAndroid() and target.os.version_range.linux.android < 29,

        .windows,
        .freebsd,
        .netbsd,
        .openbsd,
        .freestanding,
        .fuchsia,
        .managarm,
        .rtems,
        .cuda,
        .nvcl,
        .amdhsa,
        .psx,
        .ps3,
        .ps4,
        .ps5,
        .psp,
        .vita,
        .mesa3d,
        .contiki,
        .amdpal,
        .hermit,
        .hurd,
        .wasi,
        .emscripten,
        .uefi,
        .opencl,
        .opengl,
        .vulkan,
        .plan9,
        .other,
        .@"3ds",
        .wiiu,
        .@"switch",
        .tios,
        .ashetos,
        => false,
    };
}