File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -255,6 +255,7 @@ fn should_use_raw_dylib_linking(lib_name: &str) -> bool {
255255}
256256
257257fn emit_link_config ( build_config : & BuildConfig ) -> Result < ( ) > {
258+ let target_os = cargo_env_var ( "CARGO_CFG_TARGET_OS" ) . unwrap ( ) ;
258259 let interpreter_config = & build_config. interpreter_config ;
259260
260261 let lib_name = interpreter_config
@@ -275,12 +276,19 @@ fn emit_link_config(build_config: &BuildConfig) -> Result<()> {
275276 }
276277
277278 println ! (
278- "cargo:rustc-link-lib={link_model}pythonXY: {lib_name}" ,
279+ "cargo:rustc-link-lib={link_model}{alias} {lib_name}" ,
279280 link_model = if interpreter_config. shared( ) {
280281 ""
281282 } else {
282283 "static="
283284 } ,
285+ // on windows we emit `#[link(name = "pythonXY")]` attributes
286+ // and need this alias here to get the right name for the final link
287+ alias = if target_os == "windows" {
288+ "pythonXY:"
289+ } else {
290+ ""
291+ }
284292 ) ;
285293
286294 if let Some ( lib_dir) = interpreter_config. lib_dir ( ) {
You can’t perform that action at this time.
0 commit comments