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. Private Constant

Dl

Private Constant
std.Io.Threaded.Dl
const Dl = switch (native_os)

File

Io/Threaded.zig:93
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
const Dl = switch (native_os) {
    .windows => struct {
        iphlpapi_dll: std.atomic.Value(?*anyopaque),
        ConvertInterfaceNameToLuidW: std.atomic.Value(?*const fn (
            InterfaceName: [*:0]const windows.WCHAR,
            InterfaceLuid: *windows.NET.LUID,
        ) callconv(.winapi) windows.Win32Error),
        ConvertInterfaceLuidToIndex: std.atomic.Value(?*const fn (
            InterfaceLuid: *const windows.NET.LUID,
            InterfaceIndex: *windows.NET.IFINDEX,
        ) callconv(.winapi) windows.Win32Error),
        ConvertInterfaceIndexToLuid: std.atomic.Value(?*const fn (
            InterfaceIndex: std.os.windows.NET.IFINDEX,
            InterfaceLuid: *std.os.windows.NET.LUID,
        ) callconv(.winapi) windows.Win32Error),
        ConvertInterfaceLuidToNameW: std.atomic.Value(?*const fn (
            InterfaceLuid: *const std.os.windows.NET.LUID,
            InterfaceName: std.os.windows.PWSTR,
            Length: std.os.windows.SIZE_T,
        ) callconv(.winapi) std.os.windows.Win32Error),

        dnsapi_dll: std.atomic.Value(?*anyopaque),
        DnsQueryEx: std.atomic.Value(?*const fn (
            pQueryRequest: *const windows.DNS.QUERY.REQUEST,
            pQueryResults: *windows.DNS.QUERY.RESULT,
            pCancelHandle: ?*windows.DNS.QUERY.CANCEL,
        ) callconv(.winapi) windows.DNS.STATUS),
        //DnsCancelQuery: std.atomic.Value(?*const fn (
        //    pCancelHandle: *const windows.DNS.QUERY.CANCEL,
        //) callconv(.winapi) windows.DNS.STATUS),
        DnsFree: std.atomic.Value(?*const fn (
            pRecordList: ?*anyopaque,
            FreeType: windows.DNS.FREE_TYPE,
        ) callconv(.winapi) void),

        const init: Dl = .{
            .iphlpapi_dll = .init(null),
            .ConvertInterfaceNameToLuidW = .init(null),
            .ConvertInterfaceLuidToIndex = .init(null),
            .ConvertInterfaceIndexToLuid = .init(null),
            .ConvertInterfaceLuidToNameW = .init(null),

            .dnsapi_dll = .init(null),
            .DnsQueryEx = .init(null),
            //.DnsCancelQuery = .init(null),
            .DnsFree = .init(null),
        };
        fn deinit(dl: *Dl) void {
            if (dl.iphlpapi_dll.raw) |iphlpapi_dll| switch (windows.ntdll.LdrUnloadDll(iphlpapi_dll)) {
                .SUCCESS => {},
                else => |status| windows.unexpectedStatus(status) catch {},
            };
            dl.* = .init;
        }
    },
    else => struct {
        const init: Dl = .{};
        fn deinit(_: Dl) void {}
    },
}