rustc_target/spec/base/windows_msvc.rs
1use crate::spec::{TargetOptions, base, cvs};
2
3pub(crate) fn opts() -> TargetOptions {
4 let base = base::msvc::opts();
5
6 TargetOptions {
7 os: "windows".into(),
8 env: "msvc".into(),
9 vendor: "pc".into(),
10 dynamic_linking: true,
11 dll_prefix: "".into(),
12 dll_suffix: ".dll".into(),
13 exe_suffix: ".exe".into(),
14 staticlib_prefix: "".into(),
15 staticlib_suffix: ".lib".into(),
16 families: cvs!["windows"],
17 crt_static_allows_dylibs: true,
18 crt_static_respected: true,
19 requires_uwtable: true,
20 // We don't pass the /NODEFAULTLIB flag to the linker on MSVC
21 // as that prevents linker directives embedded in object files from
22 // including other necessary libraries.
23 //
24 // For example, msvcrt.lib embeds a linker directive like:
25 // /DEFAULTLIB:vcruntime.lib /DEFAULTLIB:ucrt.lib
26 // So that vcruntime.lib and ucrt.lib are included when the entry point
27 // in msvcrt.lib is used. Using /NODEFAULTLIB would mean having to
28 // manually add those two libraries and potentially further dependencies
29 // they bring in.
30 //
31 // See also https://learn.microsoft.com/en-us/cpp/preprocessor/comment-c-cpp?view=msvc-170#lib
32 // for documentation on including library dependencies in C/C++ code.
33 no_default_libraries: false,
34 has_thread_local: true,
35
36 ..base
37 }
38}