mirror of
https://github.com/openharmony/third_party_rust_libloading.git
synced 2026-07-19 13:16:19 -04:00
Use RTLD_LOCAL | RTLD_LAZY as default dlopen flags
This commit is contained in:
+4
-4
@@ -103,12 +103,12 @@ impl Library {
|
||||
/// a file. Otherwise, platform-specific algorithms are employed to find a library with a
|
||||
/// matching file name.
|
||||
///
|
||||
/// This is equivalent to [`Library::open`]`(filename, RTLD_NOW)`.
|
||||
/// This is equivalent to [`Library::open`]`(filename, RTLD_LAZY | RTLD_LOCAL)`.
|
||||
///
|
||||
/// [path separator]: std::path::MAIN_SEPARATOR
|
||||
#[inline]
|
||||
pub fn new<P: AsRef<OsStr>>(filename: P) -> Result<Library, crate::Error> {
|
||||
Library::open(Some(filename), RTLD_NOW)
|
||||
Library::open(Some(filename), RTLD_LAZY | RTLD_LOCAL)
|
||||
}
|
||||
|
||||
/// Eagerly load the `Library` representing the current executable.
|
||||
@@ -124,12 +124,12 @@ impl Library {
|
||||
/// Note that behaviour of `Library` loaded with this method is different from
|
||||
/// Libraries loaded with [`os::windows::Library::this`].
|
||||
///
|
||||
/// This is equivalent to [`Library::open`]`(None, RTLD_NOW)`.
|
||||
/// This is equivalent to [`Library::open`]`(None, RTLD_LAZY | RTLD_LOCAL)`.
|
||||
///
|
||||
/// [`os::windows::Library::this`]: crate::os::windows::Library::this
|
||||
#[inline]
|
||||
pub fn this() -> Library {
|
||||
Library::open(None::<&OsStr>, RTLD_NOW).expect("this should never fail")
|
||||
Library::open(None::<&OsStr>, RTLD_LAZY | RTLD_LOCAL).expect("this should never fail")
|
||||
}
|
||||
|
||||
/// Find and load an executable object file (shared library).
|
||||
|
||||
Reference in New Issue
Block a user