Skip to content

Commit 1a5fb60

Browse files
committed
build.rs
1 parent 949864a commit 1a5fb60

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

builtins-test-intrinsics/build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,9 @@ fn main() {
88
let target = builtins_configure::Target::from_env();
99
builtins_configure::configure_f16_f128(&target);
1010
builtins_configure::configure_aliases(&target);
11+
12+
if target.os == "windows" {
13+
// Needed for using the `mainCRTStartup` entrypoint.
14+
println!("cargo::rustc-link-arg=/subsystem:console");
15+
}
1116
}

builtins-test-intrinsics/src/main.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,12 +650,20 @@ fn something_with_a_dtor(f: &dyn Fn()) {
650650

651651
#[no_mangle]
652652
#[cfg(not(thumb))]
653-
#[cfg(not(any(thumb)))]
653+
#[cfg(not(any(thumb, windows)))]
654654
extern "C" fn main(_argc: core::ffi::c_int, _argv: *const *const u8) -> core::ffi::c_int {
655655
run();
656656
0
657657
}
658658

659+
#[no_mangle]
660+
#[cfg(windows)]
661+
#[allow(non_snake_case)]
662+
extern "C" fn mainCRTStartup() -> core::ffi::c_int {
663+
run();
664+
0
665+
}
666+
659667
#[no_mangle]
660668
#[cfg(thumb)]
661669
extern "C" fn _start() -> ! {

0 commit comments

Comments
 (0)