about summary refs log tree commit diff
path: root/example/mini_core.rs
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2022-08-24 18:40:58 +0200
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2022-08-24 18:40:58 +0200
commitcfef0a4f8df6085a81f130674e9c2f67b042fd02 (patch)
treeca5124b76f0b410976a5aeac6341ba2dfa036e9f /example/mini_core.rs
parent5a9b11648ff069954b27f07e8fc7debdd013b8d8 (diff)
downloadrust-cfef0a4f8df6085a81f130674e9c2f67b042fd02.tar.gz
rust-cfef0a4f8df6085a81f130674e9c2f67b042fd02.zip
Merge commit 'e9d1a0a7b0b28dd422f1a790ccde532acafbf193' into sync_cg_clif-2022-08-24
Diffstat (limited to 'example/mini_core.rs')
-rw-r--r--example/mini_core.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/example/mini_core.rs b/example/mini_core.rs
index 8b6042a3d66..42f8aa50ba1 100644
--- a/example/mini_core.rs
+++ b/example/mini_core.rs
@@ -535,7 +535,7 @@ unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
 }
 
 #[lang = "box_free"]
-unsafe fn box_free<T: ?Sized>(ptr: Unique<T>, alloc: ()) {
+unsafe fn box_free<T: ?Sized>(ptr: Unique<T>, _alloc: ()) {
     libc::free(ptr.pointer.0 as *mut u8);
 }
 
@@ -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);