Skip to content

Commit d1b376c

Browse files
authored
Fail if dynamically loading a pre-2025.1 OpenVINO library (#170)
Much like #149, this adds a dynamic check to avoid pre-2025.1 versions when dynamically linking an OpenVINO library. The reasons for this are documented in [#167]. [#167]: #167
1 parent e7f5cdc commit d1b376c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

crates/openvino-sys/src/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ pub mod library {
5454
/// When compiled with the `runtime-linking` feature, this may fail if the `openvino-finder`
5555
/// cannot discover the library on the current system. This may also fail if we link to a
5656
/// version of OpenVINO that is too old for these Rust bindings: the upstream library changed
57-
/// the `ov_element_type_e` enum in a backwards-incompatible way in v2024.2, meaning users would
58-
/// unintentionally use the wrong type when creating tensors (see [#143]).
57+
/// the `ov_element_type_e` enum in a backwards-incompatible way in v2025.1, meaning users would
58+
/// unintentionally use the wrong type when creating tensors (see [#167]).
5959
///
60-
/// [#143]: https://github.com/intel/openvino-rs/issues/143
60+
/// [#167]: https://github.com/intel/openvino-rs/issues/167
6161
pub fn load() -> Result<(), String> {
6262
super::generated::load()?;
6363
let version = get_version()?;
64-
if is_pre_2024_2_version(&version) {
65-
return Err(format!("OpenVINO version is too old (see https://github.com/intel/openvino-rs/issues/143): {version}"));
64+
if is_pre_2025_1_version(&version) {
65+
return Err(format!("OpenVINO version is too old (see https://github.com/intel/openvino-rs/issues/167): {version}"));
6666
}
6767
Ok(())
6868
}
@@ -86,12 +86,12 @@ pub mod library {
8686
Ok(version)
8787
}
8888

89-
/// Parse the version string and return true if it is older than 2024.2.
90-
fn is_pre_2024_2_version(version: &str) -> bool {
89+
/// Parse the version string and return true if it is older than 2025.1.
90+
fn is_pre_2025_1_version(version: &str) -> bool {
9191
let mut parts = version.split(['.', '-']);
9292
let year: usize = parts.next().unwrap().parse().unwrap();
9393
let minor: usize = parts.next().unwrap().parse().unwrap();
94-
year < 2024 || (year == 2024 && minor < 2)
94+
year < 2025 || (year == 2025 && minor < 1)
9595
}
9696

9797
/// Return the location of the shared library `openvino-sys` will link to. If compiled with

0 commit comments

Comments
 (0)