From 05a529cbcbe84dd6115b1f70aa75f060b37db998 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Tue, 31 Dec 2024 14:53:09 +0100 Subject: [PATCH] Fix is_flag_supported on msvc (#1336) --- src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index b2d0979e..f371770b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -727,6 +727,13 @@ impl Build { cmd.arg(&src); + // On MSVC skip the CRT by setting the entry point to `main`. + // This way we don't need to add the default library paths. + if compiler.is_like_msvc() { + // Flags from _LINK_ are appended to the linker arguments. + cmd.env("_LINK_", "-entry:main"); + } + let output = cmd.output()?; let is_supported = output.status.success() && output.stderr.is_empty();