diff options
| author | Afonso Bordado <afonsobordado@az8.co> | 2022-08-01 09:57:43 +0100 |
|---|---|---|
| committer | Afonso Bordado <afonsobordado@az8.co> | 2022-08-01 09:57:53 +0100 |
| commit | 8f5330e28c0f694958044752aaea75fa5aeaa211 (patch) | |
| tree | 5c1335952360862abadda84870c2b4678f0f6ce3 | |
| parent | 46fa744e6914bb4f09bc250f059e1879b65a7160 (diff) | |
| download | rust-8f5330e28c0f694958044752aaea75fa5aeaa211.tar.gz rust-8f5330e28c0f694958044752aaea75fa5aeaa211.zip | |
Fix mini_core printf linking on windows
Link against legacy_stdio_definitions on windows which provides printf as a linkable symbol.
| -rw-r--r-- | example/mini_core.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/example/mini_core.rs b/example/mini_core.rs index 8b6042a3d66..f0e85ca478e 100644 --- a/example/mini_core.rs +++ b/example/mini_core.rs @@ -575,11 +575,19 @@ pub mod intrinsics { } pub mod libc { + // With the new Universal CRT, msvc has switched to all the printf functions being inline wrapper + // functions. legacy_stdio_definitions.lib which provides the printf wrapper functions as normal + // symbols to link against. + #[cfg_attr(unix, link(name = "c"))] + #[cfg_attr(target_env="msvc", link(name="legacy_stdio_definitions"))] + extern "C" { + pub fn printf(format: *const i8, ...) -> i32; + } + #[cfg_attr(unix, link(name = "c"))] #[cfg_attr(target_env = "msvc", link(name = "msvcrt"))] extern "C" { pub fn puts(s: *const i8) -> i32; - pub fn printf(format: *const i8, ...) -> i32; pub fn malloc(size: usize) -> *mut u8; pub fn free(ptr: *mut u8); pub fn memcpy(dst: *mut u8, src: *const u8, size: usize); |
