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 › findNativeKernel32LibDir Private Function findNativeKernel32LibDir Doc Source Private Function std.zig.LibCInstallation.findNativeKernel32LibDir
fn findNativeKernel32LibDir (
self : *LibCInstallation ,
gpa : Allocator ,
io : Io ,
args : FindNativeOptions ,
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: 478
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522 fn findNativeKernel32LibDir (
self : *LibCInstallation ,
gpa : Allocator ,
io : Io ,
args : FindNativeOptions ,
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 ();
const arch_sub_dir = switch (args .target .cpu .arch ) {
.x86 => "x86" ,
.x86_64 => "x64" ,
.thumb => "arm" ,
.aarch64 => "arm64" ,
else => return error .UnsupportedArchitecture ,
};
for (installs ) |install | {
result_buf .shrinkAndFree (0 );
try result_buf .print ("{s}\\Lib\\{s}\\um\\{s}" , .{ install .path , install .version , arch_sub_dir });
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 , "kernel32.lib" , .{}) catch |err | switch (err ) {
error .FileNotFound => continue ,
else => return error .FileSystem ,
};
self .kernel32_lib_dir = try result_buf .toOwnedSlice ();
return ;
}
return error .LibCKernel32LibNotFound ;
}