diff options
author | Chris Denton <chris@chrisdenton.dev> | 2023-04-26 05:45:56 +0100 |
---|---|---|
committer | Chris Denton <chris@chrisdenton.dev> | 2023-04-26 06:00:33 +0100 |
commit | 34866c136d14b835d0a7cb559d29cd1fcecdb7dd (patch) | |
tree | 9eda2c9d796aa488c4a0c6e188700bc1ead87892 | |
parent | 5744793b48ddd451ed0690e486845f60280150a3 (diff) | |
download | rust-libc-34866c136d14b835d0a7cb559d29cd1fcecdb7dd.tar.gz |
Don't link `legacy_stdio_definitions` from std
std on Windows does not use `printf` or `fprintf` so never needs the `legacy_stdio_definitions.lib` import library.
-rw-r--r-- | src/windows/mod.rs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/windows/mod.rs b/src/windows/mod.rs index 7f2f1ded19..26bff7f7a6 100644 --- a/src/windows/mod.rs +++ b/src/windows/mod.rs @@ -278,13 +278,17 @@ impl ::Clone for fpos_t { } // Special handling for all print and scan type functions because of https://github.com/rust-lang/libc/issues/2860 -#[cfg_attr( - all(windows, target_env = "msvc"), - link(name = "legacy_stdio_definitions") -)] -extern "C" { - pub fn printf(format: *const c_char, ...) -> ::c_int; - pub fn fprintf(stream: *mut FILE, format: *const c_char, ...) -> ::c_int; +cfg_if! { + if #[cfg(not(feature = "rustc-dep-of-std"))] { + #[cfg_attr( + all(windows, target_env = "msvc"), + link(name = "legacy_stdio_definitions") + )] + extern "C" { + pub fn printf(format: *const c_char, ...) -> ::c_int; + pub fn fprintf(stream: *mut FILE, format: *const c_char, ...) -> ::c_int; + } + } } extern "C" { |