Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/libloading.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
rust_toolchain: [nightly, stable, 1.63.0]
rust_toolchain: [nightly, stable, 1.71.0]
os: [ubuntu-latest, windows-latest, macOS-latest]
timeout-minutes: 20
steps:
Expand All @@ -24,7 +24,7 @@ jobs:
- run: rustup default ${{ matrix.rust_toolchain }}
- run: rustup component add clippy
- run: cargo update -p libc --precise 0.2.155
if: ${{ matrix.rust_toolchain == '1.63.0' }}
if: ${{ matrix.rust_toolchain == '1.71.0' }}
- run: cargo clippy
- run: cargo test -- --nocapture
- run: cargo test --release -- --nocapture
Expand Down
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libloading"
# When bumping
# * Don’t forget to add an entry to `src/changelog.rs`
# * If bumping to an incompatible version, adjust the documentation in `src/lib.rs`
version = "0.8.8"
version = "0.8.9"
authors = ["Simonas Kazlauskas <[email protected]>"]
license = "ISC"
repository = "https://github.com/nagisa/rust_libloading/"
Expand All @@ -12,14 +12,14 @@ readme = "README.mkd"
description = "Bindings around the platform's dynamic library loading primitives with greatly improved memory safety."
keywords = ["dlopen", "load", "shared", "dylib"]
categories = ["api-bindings"]
rust-version = "1.56.0"
rust-version = "1.71.0"
edition = "2015"

[target.'cfg(windows)'.dependencies.windows-targets]
version = ">=0.48, <0.54"
[target.'cfg(windows)'.dependencies.windows-link]
version = "0.2"

[target.'cfg(windows)'.dev-dependencies.windows-sys]
version = ">=0.52,<0.60"
version = "0.61"
features = ["Win32_Foundation"]

[target.'cfg(unix)'.dependencies.cfg-if]
Expand Down
7 changes: 7 additions & 0 deletions src/changelog.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
//! The change log.

/// Release 0.8.9 (2025-09-17)
///
/// ## Non-breaking changes
///
/// Migrate from windows-targets to windows-link for linking Windows API functions.
pub mod r0_8_9 {}

/// Release 0.8.8 (2025-05-27)
///
/// ## Non-breaking changes
Expand Down
49 changes: 29 additions & 20 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::ffi::{CString, CStr};
use std::ffi::{CStr, CString};

/// A `dlerror` error.
pub struct DlDescription(pub(crate) CString);
Expand Down Expand Up @@ -31,49 +31,49 @@ pub enum Error {
/// The `dlopen` call failed.
DlOpen {
/// The source error.
desc: DlDescription
desc: DlDescription,
},
/// The `dlopen` call failed and system did not report an error.
DlOpenUnknown,
/// The `dlsym` call failed.
DlSym {
/// The source error.
desc: DlDescription
desc: DlDescription,
},
/// The `dlsym` call failed and system did not report an error.
DlSymUnknown,
/// The `dlclose` call failed.
DlClose {
/// The source error.
desc: DlDescription
desc: DlDescription,
},
/// The `dlclose` call failed and system did not report an error.
DlCloseUnknown,
/// The `LoadLibraryW` call failed.
LoadLibraryExW {
/// The source error.
source: WindowsError
source: WindowsError,
},
/// The `LoadLibraryW` call failed and system did not report an error.
LoadLibraryExWUnknown,
/// The `GetModuleHandleExW` call failed.
GetModuleHandleExW {
/// The source error.
source: WindowsError
source: WindowsError,
},
/// The `GetModuleHandleExW` call failed and system did not report an error.
GetModuleHandleExWUnknown,
/// The `GetProcAddress` call failed.
GetProcAddress {
/// The source error.
source: WindowsError
source: WindowsError,
},
/// The `GetProcAddressUnknown` call failed and system did not report an error.
GetProcAddressUnknown,
/// The `FreeLibrary` call failed.
FreeLibrary {
/// The source error.
source: WindowsError
source: WindowsError,
},
/// The `FreeLibrary` call failed and system did not report an error.
FreeLibraryUnknown,
Expand All @@ -82,12 +82,12 @@ pub enum Error {
/// Could not create a new CString.
CreateCString {
/// The source error.
source: std::ffi::NulError
source: std::ffi::NulError,
},
/// Could not create a new CString from bytes with trailing null.
CreateCStringWithTrailing {
/// The source error.
source: std::ffi::FromBytesWithNulError
source: std::ffi::FromBytesWithNulError,
},
}

Expand Down Expand Up @@ -117,20 +117,29 @@ impl std::fmt::Display for Error {
DlClose { ref desc } => write!(f, "{}", desc.0.to_string_lossy()),
DlCloseUnknown => write!(f, "dlclose failed, but system did not report the error"),
LoadLibraryExW { .. } => write!(f, "LoadLibraryExW failed"),
LoadLibraryExWUnknown =>
write!(f, "LoadLibraryExW failed, but system did not report the error"),
LoadLibraryExWUnknown => write!(
f,
"LoadLibraryExW failed, but system did not report the error"
),
GetModuleHandleExW { .. } => write!(f, "GetModuleHandleExW failed"),
GetModuleHandleExWUnknown =>
write!(f, "GetModuleHandleExWUnknown failed, but system did not report the error"),
GetModuleHandleExWUnknown => write!(
f,
"GetModuleHandleExWUnknown failed, but system did not report the error"
),
GetProcAddress { .. } => write!(f, "GetProcAddress failed"),
GetProcAddressUnknown =>
write!(f, "GetProcAddress failed, but system did not report the error"),
GetProcAddressUnknown => write!(
f,
"GetProcAddress failed, but system did not report the error"
),
FreeLibrary { .. } => write!(f, "FreeLibrary failed"),
FreeLibraryUnknown =>
write!(f, "FreeLibrary failed, but system did not report the error"),
FreeLibraryUnknown => {
write!(f, "FreeLibrary failed, but system did not report the error")
}
CreateCString { .. } => write!(f, "could not create a C string from bytes"),
CreateCStringWithTrailing { .. } =>
write!(f, "could not create a C string from bytes with trailing null"),
CreateCStringWithTrailing { .. } => write!(
f,
"could not create a C string from bytes with trailing null"
),
IncompatibleSize => write!(f, "requested type cannot possibly work"),
}
}
Expand Down
9 changes: 6 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,18 @@
//!
//! The compiler will ensure that the loaded function will not outlive the `Library` from which it comes,
//! preventing the most common memory-safety issues.
#![cfg_attr(any(unix, windows), deny(missing_docs, clippy::all, unreachable_pub, unused))]
#![cfg_attr(
any(unix, windows),
deny(missing_docs, clippy::all, unreachable_pub, unused)
)]
#![cfg_attr(libloading_docs, feature(doc_cfg))]

pub mod changelog;
pub mod os;
mod util;
mod error;
pub mod os;
#[cfg(any(unix, windows, libloading_docs))]
mod safe;
mod util;

pub use self::error::Error;
#[cfg(any(unix, windows, libloading_docs))]
Expand Down
Loading
Loading