Skip to content

Commit bafb3c9

Browse files
committed
Provide a weak DllMain fallback entry point
Wrt. ldc-developers/ldc#3142.
1 parent a0dbcfa commit bafb3c9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

msvcrt_stub.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,17 @@ _DllMainCRTStartup (HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved)
6464
return bRet;
6565
}
6666

67+
BOOL WINAPI __DefaultDllMain (HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved)
68+
{
69+
return TRUE;
70+
}
71+
72+
#ifdef _M_X64
73+
__pragma(comment(linker, "/alternatename:DllMain=__DefaultDllMain"));
74+
#else
75+
__pragma(comment(linker, "/alternatename:_DllMain@12=___DefaultDllMain@12"));
76+
#endif
77+
6778
#else // _APPTYPE != __UNKNOWN_APP
6879

6980
extern int __argc;

0 commit comments

Comments
 (0)