Lines Matching full:library
13 /// A loaded dynamic library.
15 pub struct Library(imp::Library); struct
17 impl Library { implementation
18 /// Find and load a dynamic library.
22 /// * A library filename;
23 /// * The absolute path to the library;
24 /// * A relative (to the current working directory) path to the library.
28 /// When a library is loaded, initialisation routines contained within it are executed.
34 /// termination routines contained within the library is safe as well. These routines may be
35 /// executed when the library is unloaded.
40 /// platforms the underlying error-handling related APIs not always MT-safe. This library
45 /// library filenames and the library search path is modified (`SetDllDirectory` function on
50 … /// When a plain library filename is supplied, the locations in which the library is searched are
52 /// the platform specific [`os::unix::Library::new`] and [`os::windows::Library::new`] methods
53 /// for further information on library lookup behaviour.
55 … /// If the `filename` specifies a library filename without a path and with the extension omitted,
58 /// [`os::unix::Library::new`]: crate::os::unix::Library::new
59 /// [`os::windows::Library::new`]: crate::os::windows::Library::new
65 /// library filenames.
67 /// Strive to specify an absolute or at least a relative path to your library, unless
68 /// system-wide libraries are being loaded. Platform-dependent library search locations
75 /// # use ::libloading::Library;
78 /// let _ = Library::new("/path/to/awesome.module").unwrap();
79 /// let _ = Library::new("../awesome.module").unwrap();
80 /// let _ = Library::new("libsomelib.so.1").unwrap();
83 pub unsafe fn new<P: AsRef<OsStr>>(filename: P) -> Result<Library, Error> { in new() argument
84 imp::Library::new(filename).map(From::from) in new()
108 /// consider using the [`os::unix::Library::get_singlethreaded`] call.
110 /// [`os::unix::Library::get_singlethreaded`]: crate::os::unix::Library::get_singlethreaded
114 /// Given a loaded library:
117 /// # use ::libloading::Library;
119 /// Library::new("/path/to/awesome.module").unwrap()
126 /// # use ::libloading::{Library, Symbol};
128 /// # Library::new("/path/to/awesome.module").unwrap()
140 /// # use ::libloading::{Library, Symbol};
141 /// # let lib = unsafe { Library::new("/path/to/awesome.module").unwrap() };
151 /// Unload the library.
153 /// This method might be a no-op, depending on the flags with which the `Library` was opened,
154 /// what library was opened or other platform specifics.
157 /// library is unloaded. Otherwise the implementation of `Drop` for `Library` will close the
158 /// library and ignore the errors were they arise.
166 impl fmt::Debug for Library { implementation
172 impl From<imp::Library> for Library { implementation
173 fn from(lib: imp::Library) -> Library { in from() argument
174 Library(lib) in from()
178 impl From<Library> for imp::Library { implementation
179 fn from(lib: Library) -> imp::Library { in from() argument
184 unsafe impl Send for Library {} implementation
185 unsafe impl Sync for Library {} implementation
187 /// Symbol from a library.
189 /// This type is a safeguard against using dynamically loaded symbols after a `Library` is
190 /// unloaded. The primary method to create an instance of a `Symbol` is via [`Library::get`].
195 /// [`Library::get`]: Library::get
208 /// ensure the resulting `Symbol` is not used past the lifetime of the `Library` this symbol
214 /// # use ::libloading::{Library, Symbol};
216 /// let lib = Library::new("/path/to/awesome.module").unwrap();
227 /// Note that, in order to create association between the symbol and the library this symbol
228 /// came from, this function requires a reference to the library.
232 /// The `library` reference must be exactly the library `sym` was loaded from.
237 /// # use ::libloading::{Library, Symbol};
239 /// let lib = Library::new("/path/to/awesome.module").unwrap();
245 pub unsafe fn from_raw<L>(sym: imp::Symbol<T>, library: &'lib L) -> Symbol<'lib, T> { in from_raw()
246 let _ = library; // ignore here for documentation purposes. in from_raw()
260 /// # use ::libloading::{Library, Symbol};
262 /// let lib = Library::new("/path/to/awesome.module").unwrap();