Skip to content

Commit 9fbe667

Browse files
committed
Don't unload hdf5 in build script
1 parent ae15350 commit 9fbe667

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

hdf5-sys/build.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,19 @@ fn get_runtime_version_single<P: AsRef<Path>>(path: P) -> Result<Version, Box<dy
9191
let H5get_libversion = unsafe { lib.get::<H5get_libversion_t>(b"H5get_libversion")? };
9292

9393
let mut v: (c_uint, c_uint, c_uint) = (0, 0, 0);
94-
unsafe {
94+
let res = unsafe {
9595
if H5open() != 0 {
9696
Err("H5open()".into())
9797
} else if H5get_libversion(&mut v.0, &mut v.1, &mut v.2) != 0 {
9898
Err("H5get_libversion()".into())
9999
} else {
100100
Ok(Version::new(v.0 as _, v.1 as _, v.2 as _))
101101
}
102-
}
102+
};
103+
// On macos libraries using TLS will corrupt TLS from rust. We delay closing
104+
// the library until program exit by forgetting the library
105+
std::mem::forget(lib);
106+
res
103107
}
104108

105109
fn validate_runtime_version(config: &Config) {

0 commit comments

Comments
 (0)