Lines Matching refs:Library
37 // On platforms where `dlerror` is still MT-unsafe, `dlsym` (`Library::get`) can spuriously
75 /// A platform-specific counterpart of the cross-platform [`Library`](crate::Library).
76 pub struct Library {
80 unsafe impl Send for Library {}
96 unsafe impl Sync for Library {}
98 impl Library {
105 /// This is equivalent to <code>[Library::open](filename, [RTLD_LAZY] | [RTLD_LOCAL])</code>.
120 pub unsafe fn new<P: AsRef<OsStr>>(filename: P) -> Result<Library, crate::Error> {
121 Library::open(Some(filename), RTLD_LAZY | RTLD_LOCAL)
124 /// Load the `Library` representing the current executable.
126 /// [`Library::get`] calls of the returned `Library` will look for symbols in following
131 /// 3. Any executable object files loaded at runtime (e.g. via other `Library::new` calls or via
134 /// Note that the behaviour of a `Library` loaded with this method is different from that of
135 /// Libraries loaded with [`os::windows::Library::this`].
137 /// This is equivalent to <code>[Library::open](None, [RTLD_LAZY] | [RTLD_LOCAL])</code>.
139 /// [`os::windows::Library::this`]: crate::os::windows::Library::this
141 pub fn this() -> Library {
145 Library::open(None::<&OsStr>, RTLD_LAZY | RTLD_LOCAL).expect("this should never fail")
151 /// See documentation for [`Library::this`] for further description of the behaviour
152 /// when the `filename` is `None`. Otherwise see [`Library::new`].
166 pub unsafe fn open<P>(filename: Option<P>, flags: raw::c_int) -> Result<Library, crate::Error>
182 Some(Library {
241 /// consider using the [`Library::get_singlethreaded`] call.
293 /// Convert the `Library` to a raw handle.
303 /// Convert a raw handle returned by `dlopen`-family of calls to a `Library`.
308 /// pointer previously returned by `Library::into_raw` call. It must be valid to call `dlclose`
310 pub unsafe fn from_raw(handle: *mut raw::c_void) -> Library {
311 Library {
318 /// This method might be a no-op, depending on the flags with which the `Library` was opened,
322 /// library is unloaded. Otherwise the implementation of `Drop` for `Library` will close the
342 impl Drop for Library {
350 impl fmt::Debug for Library {
352 f.write_str(&format!("Library@{:p}", self.handle))
359 /// `Symbol` does not outlive the `Library` it comes from.