Skip to content

Commit 2ec8995

Browse files
committed
Fix for #2860
1 parent 7d55e38 commit 2ec8995

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/windows/mod.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,16 @@ impl ::Clone for fpos_t {
277277
}
278278
}
279279

280+
// Special handling for all print and scan type functions because of https://github.com/rust-lang/libc/issues/2860
281+
#[cfg_attr(
282+
all(windows, target_env = "msvc"),
283+
link(name = "legacy_stdio_definitions")
284+
)]
285+
extern "C" {
286+
pub fn printf(format: *const c_char, ...) -> ::c_int;
287+
pub fn fprintf(stream: *mut FILE, format: *const c_char, ...) -> ::c_int;
288+
}
289+
280290
extern "C" {
281291
pub fn isalnum(c: c_int) -> c_int;
282292
pub fn isalpha(c: c_int) -> c_int;
@@ -319,8 +329,6 @@ extern "C" {
319329
pub fn feof(stream: *mut FILE) -> c_int;
320330
pub fn ferror(stream: *mut FILE) -> c_int;
321331
pub fn perror(s: *const c_char);
322-
pub fn printf(format: *const c_char, ...) -> ::c_int;
323-
pub fn fprintf(stream: *mut FILE, format: *const c_char, ...) -> ::c_int;
324332
pub fn atoi(s: *const c_char) -> c_int;
325333
pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
326334
pub fn strtof(s: *const c_char, endp: *mut *mut c_char) -> c_float;

0 commit comments

Comments
 (0)