Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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 standard library. Public Function

find

Public Function
std.zig.WindowsSdk.find
pub fn find(
    gpa: Allocator,
    io: Io,
    arch: std.Target.Cpu.Arch,
    environ_map: *const Environ.Map,
) error

Find path and version of Windows 10 SDK and Windows 8.1 SDK, and find path to MSVC's lib/ directory. Caller owns the result's fields. Returns memory allocated by gpa

Params

File

zig/WindowsSdk.zig:29
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
pub fn find(
    gpa: Allocator,
    io: Io,
    arch: std.Target.Cpu.Arch,
    environ_map: *const Environ.Map,
) error{ OutOfMemory, NotFound, PathTooLong }!WindowsSdk {
    if (builtin.os.tag != .windows) return error.NotFound;

    var registry: Registry = .{};
    defer registry.deinit();

    // If this key doesn't exist, neither the Win 8 SDK nor the Win 10 SDK is installed
    const roots_key = registry.openSoftwareKey(.{ .root = .local_machine, .wow64 = .wow64_32 }, L(windows_kits_reg_key)) catch |err| switch (err) {
        error.KeyNotFound => return error.NotFound,
    };
    defer roots_key.close();

    const windows10sdk = Installation.find(gpa, io, &registry, roots_key, L("KitsRoot10"), "", L("v10.0")) catch |err| switch (err) {
        error.InstallationNotFound => null,
        error.PathTooLong => null,
        error.VersionTooLong => null,
        error.OutOfMemory => |e| return e,
    };
    errdefer if (windows10sdk) |*w| w.free(gpa);

    const windows81sdk = Installation.find(gpa, io, &registry, roots_key, L("KitsRoot81"), "winver", L("v8.1")) catch |err| switch (err) {
        error.InstallationNotFound => null,
        error.PathTooLong => null,
        error.VersionTooLong => null,
        error.OutOfMemory => |e| return e,
    };
    errdefer if (windows81sdk) |*w| w.free(gpa);

    const msvc_lib_dir: ?[]const u8 = MsvcLibDir.find(gpa, io, &registry, arch, environ_map) catch |err| switch (err) {
        error.MsvcLibDirNotFound => null,
        error.OutOfMemory => |e| return e,
    };
    errdefer gpa.free(msvc_lib_dir);

    return .{
        .windows10sdk = windows10sdk,
        .windows81sdk = windows81sdk,
        .msvc_lib_dir = msvc_lib_dir,
    };
}