DoxigAlpha

linkSystemLibrary

Function parameters

Parameters

#
m:*Module
name:[]const u8

Type definitions in this namespace

Types

#
CreateOptions
Unspecified options here will be inherited from parent `Module` when
Graph
Elements of `modules` and `names` are matched one-to-one.

Functions in this namespace

Functions

#
addImport
Adds an existing module to be used with `@import`.
addAnonymousImport
Creates a new module and adds it to be used with `@import`.
addOptions
Converts a set of key-value pairs into a Zig source file, and then inserts it into
addCSourceFiles
Handy when you have many non-Zig source files and want them all to have the same flags.
addWin32ResourceFile
Resource files must have the extension `.rc`.
addCMacro
Equvialent to the following C code, applied to all C source files owned by
getGraph
Intended to be used during the make phase only.

Source

Implementation

#
pub fn linkSystemLibrary(
    m: *Module,
    name: []const u8,
    options: LinkSystemLibraryOptions,
) void {
    const b = m.owner;

    const target = m.requireKnownTarget();
    if (std.zig.target.isLibCLibName(target, name)) {
        m.link_libc = true;
        return;
    }
    if (std.zig.target.isLibCxxLibName(target, name)) {
        m.link_libcpp = true;
        return;
    }

    m.link_objects.append(b.allocator, .{
        .system_lib = .{
            .name = b.dupe(name),
            .needed = options.needed,
            .weak = options.weak,
            .use_pkg_config = options.use_pkg_config,
            .preferred_link_mode = options.preferred_link_mode,
            .search_strategy = options.search_strategy,
        },
    }) catch @panic("OOM");
}