1 parent a4d4049 commit 898525cCopy full SHA for 898525c
1 file changed
scripts/build_c.py
@@ -172,9 +172,13 @@ def tool(name):
172
*[f"{lib}.lib" for lib in LIBS],
173
]
174
if cfg["crt"] == "none":
175
- # Decorated on x86 like the mingw entry; the linker's own undecorated lookup misses C++ objects
176
- entry = "DllMain@12" if arch == "x86" else "DllMain"
177
- link += ["/NODEFAULTLIB", f"/ENTRY:{entry}"]
+ link.append("/NODEFAULTLIB")
+ # /Zl predefines _VC_NODEFAULTLIB, which Plugins use to rename DllMain to the linker's default entry
+ if not any(
178
+ "_DllMainCRTStartup" in Path(s).read_text(errors="ignore")
179
+ for s in cfg["sources"]
180
+ ):
181
+ link.append("/ENTRY:DllMain")
182
else:
183
# A Plugin defining its own _DllMainCRTStartup keeps libcmt's startup object,
184
# and with it these defaultlib references, out of the link
0 commit comments