1// Functions of the system libraries the platforms load while running.23import std::ffi;4import std::option;5import std::string;67// The library's function of that name, as the C prototype `F`; a library8// lacking it is older than any the package supports.9pub fn function<F: CFunction>(library: &Library, name: &[u8]) -> F {10 if (library.symbol<F>(&name) is ::Some |move f|) {11 return move f;12 }13 const message = f"pkg::alloy::window: the system library lacks {name}";14 panic message.view();15}1617// The text with a NUL after it, for C.18pub fn c_text_of(text: &[u8]) -> String {19 var out = String::from(&text);20 out.push(0);21 return move out;22}