From 7ea64deb315574ec101d1ef5296177d06ba004f1 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Fri, 24 Jan 2025 14:01:16 +0900 Subject: [PATCH] Set `/DEPENDENTLOADFLAG` in Bazel Windows build (#1166) This mirrors my previous commit [1] for Windows GYP build so that Bazel build can also specify appropriate /DEPENDENTLOADFLAG options (#836). Closes #1114. [1]: 18d1bcaab499695004c3520133c4d9d4ee2d6bfd PiperOrigin-RevId: 719096319 --- src/build_defs.bzl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/build_defs.bzl b/src/build_defs.bzl index 9adfae7ab..5acba3831 100644 --- a/src/build_defs.bzl +++ b/src/build_defs.bzl @@ -345,6 +345,16 @@ def mozc_win32_cc_prod_binary( if cpu in ["@platforms//cpu:x86_32", "@platforms//cpu:x86_64"]: modified_linkopts.append("/CETCOMPAT") + LOAD_LIBRARY_SEARCH_APPLICATION_DIR = 0x200 + LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x800 + load_flags = LOAD_LIBRARY_SEARCH_SYSTEM32 + if not linkshared: + # We build *.exe with dynamic CRT and deploy CRT DLLs into the + # application dir. Thus LOAD_LIBRARY_SEARCH_APPLICATION_DIR is also + # necessary. + load_flags += LOAD_LIBRARY_SEARCH_APPLICATION_DIR + modified_linkopts.append("/DEPENDENTLOADFLAG:0x%X" % load_flags) + mozc_cc_binary( name = intermediate_name, srcs = srcs,