-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Open
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)C-bugCategory: This is a bug.Category: This is a bug.O-windowsOperating system: WindowsOperating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Description
Using #![windows_subsystem = "windows"] overwrites the default entrypoint symbol name WinMainCRTStartup with mainCRTStartup. This is by design, but can be unexpected in certain scenarios, for example when specifying #![no_main]. It should either be adapted for those scenarios, or mentioned in the user facing documentation.
Reproduction
- Create
example.rs:#![no_main] #![no_std] #[cfg(not(test))] #[panic_handler] fn panic(_: &core::panic::PanicInfo) -> ! { loop {} } #[unsafe(no_mangle)] extern "system" fn WinMainCRTStartup() -> i32 { 0 }
- Linking succeeds via:
rustc example.rs -C panic=abort -C link-arg=/Subsystem:Windows - Add
#![windows_subsystem = "windows"]toexample.rs - Linking fails via:
rustc example.rs -C panic=abort
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)C-bugCategory: This is a bug.Category: This is a bug.O-windowsOperating system: WindowsOperating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.