diff --git a/scripts/build.rs b/scripts/build.rs index 0cbb348619..acbab0ebe6 100644 --- a/scripts/build.rs +++ b/scripts/build.rs @@ -90,6 +90,20 @@ fn cmake_build() { } else if cfg!(target_os = "macos") { println!("cargo:rustc-link-lib=framework=CoreFoundation"); println!("cargo:rustc-link-lib=framework=Security"); + } else if cfg!(windows) { + // Windows system libraries that the static msquic.lib depends on. + // These are excluded from the monolithic archive (via the inc/base_link + // EXCLUDE_LIST in CMake) and must be linked explicitly by the consumer. + for lib in [ + "ws2_32", "ntdll", "bcrypt", "ncrypt", "crypt32", "iphlpapi", "advapi32", + "schannel", + ] { + println!("cargo:rustc-link-lib={lib}"); + } + if cfg!(feature = "openssl") || cfg!(feature = "quictls") { + // OpenSSL references user32 symbols (MessageBoxW, etc.) + println!("cargo:rustc-link-lib=user32"); + } } } }