Commit eea8b10463

syscall0 <syscall0@protonmail.com>
2019-11-24 17:37:56
Call DllMain entry point if declared
1 parent 6109e49
Changed files (1)
lib
std
lib/std/special/start_lib.zig
@@ -1,5 +1,6 @@
 // This file is included in the compilation unit when exporting a DLL on windows.
 
+const root = @import("root");
 const std = @import("std");
 const builtin = @import("builtin");
 
@@ -12,5 +13,9 @@ stdcallcc fn _DllMainCRTStartup(
     fdwReason: std.os.windows.DWORD,
     lpReserved: std.os.windows.LPVOID,
 ) std.os.windows.BOOL {
+    if (@hasDecl(root, "DllMain")) {
+        return root.DllMain(hinstDLL, fdwReason, lpReserved);
+    }
+
     return std.os.windows.TRUE;
 }