DoxigAlpha

glibcVerFromLinkName

Function parameters

Parameters

#
link_name:[]const u8
prefix:[]const u8

Type definitions in this namespace

Types

#

Return whether or not the given host is capable of running executables of

Functions

#
getExternalExecutor
Return whether or not the given host is capable of running executables of
resolveTargetQuery
Given a `Target.Query`, which specifies in detail which parts of the

Error sets in this namespace

Error Sets

#

Source

Implementation

#
fn glibcVerFromLinkName(link_name: []const u8, prefix: []const u8) error{ UnrecognizedGnuLibCFileName, InvalidGnuLibCVersion }!std.SemanticVersion {
    // example: "libc-2.3.4.so"
    // example: "libc-2.27.so"
    // example: "ld-2.33.so"
    const suffix = ".so";
    if (!mem.startsWith(u8, link_name, prefix) or !mem.endsWith(u8, link_name, suffix)) {
        return error.UnrecognizedGnuLibCFileName;
    }
    // chop off "libc-" and ".so"
    const link_name_chopped = link_name[prefix.len .. link_name.len - suffix.len];
    return Target.Query.parseVersion(link_name_chopped) catch |err| switch (err) {
        error.Overflow => return error.InvalidGnuLibCVersion,
        error.InvalidVersion => return error.InvalidGnuLibCVersion,
    };
}