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 standard library.
std › zig › LibCInstallation › findNativeIncludeDirWindows Private Function findNativeIncludeDirWindows Doc Source Private Function std.zig.LibCInstallation.findNativeIncludeDirWindows
fn findNativeIncludeDirWindows (
self : *LibCInstallation ,
gpa : Allocator ,
io : Io ,
sdk : std .zig .WindowsSdk ,
) FindError !void Params Errors OutOfMemory FileSystem UnableToSpawnCCompiler CCompilerExitCode CCompilerCrashed CCompilerCannotFindHeaders LibCRuntimeNotFound LibCStdLibHeaderNotFound LibCKernel32LibNotFound UnsupportedArchitecture WindowsSdkNotFound DarwinSdkNotFound ZigIsTheCCompiler File zig/LibCInstallation.zig: 373
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409 fn findNativeIncludeDirWindows (
self : *LibCInstallation ,
gpa : Allocator ,
io : Io ,
sdk : std .zig .WindowsSdk ,
) FindError !void {
var install_buf : [2 ]std .zig .WindowsSdk .Installation = undefined ;
const installs = fillInstallations (&install_buf , sdk );
var result_buf = std .array_list .Managed (u8 ).init (gpa );
defer result_buf .deinit ();
for (installs ) |install | {
result_buf .shrinkAndFree (0 );
try result_buf .print ("{s}\\Include\\{s}\\ucrt" , .{ install .path , install .version });
var dir = Io .Dir .cwd ().openDir (io , result_buf .items , .{}) catch |err | switch (err ) {
error .FileNotFound ,
error .NotDir ,
error .NoDevice ,
=> continue ,
else => return error .FileSystem ,
};
defer dir .close (io );
dir .access (io , "stdlib.h" , .{}) catch |err | switch (err ) {
error .FileNotFound => continue ,
else => return error .FileSystem ,
};
self .include_dir = try result_buf .toOwnedSlice ();
return ;
}
return error .LibCStdLibHeaderNotFound ;
}