pub struct LibLoader { /* private fields */ }
Expand description
LibLoader allows search for libraries and to load them.
Implementations§
Source§impl LibLoader
impl LibLoader
Sourcepub fn new(dirs: LibSearchDirs) -> LibLoader
pub fn new(dirs: LibSearchDirs) -> LibLoader
Creates a new LibLoader with a set of paths where the libraries will be searched for.
If exe_parent_dir
is true, the parent directory of the current executable is also added
to the set of paths for search.
Sourcepub fn search_paths(&self) -> Option<&[PathBuf]>
pub fn search_paths(&self) -> Option<&[PathBuf]>
Return the list of search paths used by this LibLoader
Sourcepub unsafe fn load_file(path: &str) -> ZResult<(Library, PathBuf)>
pub unsafe fn load_file(path: &str) -> ZResult<(Library, PathBuf)>
Load a library from the specified path.
§Safety
This function calls libloading::Library::new() which is unsafe.
Sourcepub unsafe fn search_and_load(
&self,
name: &str,
) -> ZResult<Option<(Library, PathBuf)>>
pub unsafe fn search_and_load( &self, name: &str, ) -> ZResult<Option<(Library, PathBuf)>>
Search for library with filename: LIB_PREFIX+name
+LIB_SUFFIX and load it.
The result is a tuple with:
- the Library
- its full path
§Safety
This function calls libloading::Library::new() which is unsafe.
Sourcepub unsafe fn load_all_with_prefix(
&self,
prefix: Option<&str>,
) -> Option<Vec<(Library, PathBuf, String)>>
pub unsafe fn load_all_with_prefix( &self, prefix: Option<&str>, ) -> Option<Vec<(Library, PathBuf, String)>>
Search and load all libraries with filename starting with LIB_PREFIX+prefix
and ending with LIB_SUFFIX.
The result is a list of tuple with:
- the Library
- its full path
- its short name (i.e. filename stripped of prefix and suffix)
§Safety
This function calls libloading::Library::new() which is unsafe.