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 library itself.
Zig › std/ › zig/ › system.zig › glibcVerFromLinkName
glibcVerFromLinkName
system.glibcVerFromLinkName
fn glibcVerFromLinkName (link_name : []const u8 , prefix : []const u8 ) error
File
Code
fn glibcVerFromLinkName (link_name : []const u8 , prefix : []const u8 ) error { UnrecognizedGnuLibCFileName , InvalidGnuLibCVersion }!std .SemanticVersion {
// 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 ;
}
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 ,
};
}