Skip to content

Commit 22e9e86

Browse files
authored
Merge pull request aldanor#29 from magnusuMET/bugfix/external_linkage
Use extern crate to force linkage
2 parents a6e63fd + dd2a8b8 commit 22e9e86

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

hdf5-src/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
//! Dummy crate for building HDF5 C library from source.
2+
3+
#[cfg(feature = "zlib")]
4+
extern crate libz_sys;

hdf5-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ default = []
2727
mpio = ["dep:mpi-sys"]
2828
hl = ["hdf5-src?/hl"]
2929
threadsafe = ["hdf5-src?/threadsafe"]
30-
zlib = ["libz-sys", "hdf5-src?/zlib"]
30+
zlib = ["dep:libz-sys", "hdf5-src?/zlib"]
3131
static = ["dep:hdf5-src"]
3232
deprecated = ["hdf5-src?/deprecated"]
3333

hdf5-sys/build.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -734,9 +734,6 @@ fn get_build_and_emit() {
734734
if feature_enabled("ZLIB") {
735735
let zlib_lib = env::var("DEP_HDF5SRC_ZLIB").unwrap();
736736
println!("cargo::metadata=zlib={}", &zlib_lib);
737-
let zlib_lib_header = env::var("DEP_HDF5SRC_ZLIB").unwrap();
738-
println!("cargo::metadata=zlib={}", &zlib_lib_header);
739-
println!("cargo::rustc-link-lib=static={}", &zlib_lib);
740737
}
741738

742739
if feature_enabled("HL") {

hdf5-sys/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
#![allow(clippy::module_name_repetitions)]
99
#![cfg_attr(docsrs, feature(doc_cfg))]
1010

11+
#[cfg(feature = "static")]
12+
extern crate hdf5_src;
13+
#[cfg(feature = "zlib")]
14+
extern crate libz_sys;
15+
#[cfg(feature = "mpio")]
16+
extern crate mpi_sys;
17+
1118
macro_rules! extern_static {
1219
($dest:ident, $src:ident) => {
1320
extern "C" {

0 commit comments

Comments
 (0)