pub fn library_filename<S: AsRef<OsStr>>(name: S) -> OsString
Expand description

Converts a library name to a filename generally appropriate for use on the system.

This function will prepend prefixes (such as lib) and suffixes (such as .so) to the library name to construct the filename.

Examples

It can be used to load global libraries in a platform independent manner:

use libloading::{Library, library_filename};
// Will attempt to load `libLLVM.so` on Linux, `libLLVM.dylib` on macOS and `LLVM.dll` on
// Windows.
let library = unsafe {
    Library::new(library_filename("LLVM"))
};