Skip to content

Commit

Permalink
Merge pull request #29 from magnusuMET/bugfix/external_linkage
Browse files Browse the repository at this point in the history
Use extern crate to force linkage
  • Loading branch information
magnusuMET authored Oct 18, 2024
2 parents a6e63fd + dd2a8b8 commit 22e9e86
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions hdf5-src/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
//! Dummy crate for building HDF5 C library from source.

#[cfg(feature = "zlib")]
extern crate libz_sys;
2 changes: 1 addition & 1 deletion hdf5-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ default = []
mpio = ["dep:mpi-sys"]
hl = ["hdf5-src?/hl"]
threadsafe = ["hdf5-src?/threadsafe"]
zlib = ["libz-sys", "hdf5-src?/zlib"]
zlib = ["dep:libz-sys", "hdf5-src?/zlib"]
static = ["dep:hdf5-src"]
deprecated = ["hdf5-src?/deprecated"]

Expand Down
3 changes: 0 additions & 3 deletions hdf5-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -734,9 +734,6 @@ fn get_build_and_emit() {
if feature_enabled("ZLIB") {
let zlib_lib = env::var("DEP_HDF5SRC_ZLIB").unwrap();
println!("cargo::metadata=zlib={}", &zlib_lib);
let zlib_lib_header = env::var("DEP_HDF5SRC_ZLIB").unwrap();
println!("cargo::metadata=zlib={}", &zlib_lib_header);
println!("cargo::rustc-link-lib=static={}", &zlib_lib);
}

if feature_enabled("HL") {
Expand Down
7 changes: 7 additions & 0 deletions hdf5-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
#![allow(clippy::module_name_repetitions)]
#![cfg_attr(docsrs, feature(doc_cfg))]

#[cfg(feature = "static")]
extern crate hdf5_src;
#[cfg(feature = "zlib")]
extern crate libz_sys;
#[cfg(feature = "mpio")]
extern crate mpi_sys;

macro_rules! extern_static {
($dest:ident, $src:ident) => {
extern "C" {
Expand Down

0 comments on commit 22e9e86

Please sign in to comment.