Skip to content

Commit

Permalink
Fix Windows dll name format
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron1011 committed Apr 14, 2019
1 parent 3c7c2c6 commit 7ba8a9e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/tools/compiletest/src/runtest.rs
Expand Up @@ -74,22 +74,22 @@ pub fn dylib_env_var() -> &'static str {
}
}

/// The platform-specific library file extension
pub fn lib_extension(dylib: bool) -> &'static str {
/// The platform-specific library name
pub fn get_lib_name(lib: &str, dylib: bool) -> String {
// In some casess (e.g. MUSL), we build a static
// library, rather than a dynamic library.
// In this case, the only path we can pass
// with '--extern-meta' is the '.lib' file
if !dylib {
return ".rlib"
return format!("lib{}.rlib", lib);
}

if cfg!(windows) {
".dll"
format!("{}.dll", lib)
} else if cfg!(target_os = "macos") {
".dylib"
format!("lib{}.dylib", lib)
} else {
".so"
format!("lib{}.so", lib)
}
}

Expand Down Expand Up @@ -1608,7 +1608,7 @@ impl<'test> TestCx<'test> {
let mut extern_priv = self.props.extern_private.clone();

let mut add_extern_priv = |priv_dep: &str, dylib: bool| {
let lib_name = format!("lib{}{}", priv_dep, lib_extension(dylib));
let lib_name = get_lib_name(priv_dep, dylib);
rustc
.arg("--extern-private")
.arg(format!("{}={}", priv_dep, aux_dir.join(lib_name).to_str().unwrap()));
Expand Down

0 comments on commit 7ba8a9e

Please sign in to comment.