commit eea8b10463b944dae5434e748c9a5b67c2287bea (tree)
parent 6109e49c5b0341fba8de9cf49e1a4071a7637273
Author: syscall0 <syscall0@protonmail.com>
Date: Sun, 24 Nov 2019 19:37:56 +0300
Call DllMain entry point if declared
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/lib/std/special/start_lib.zig b/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;
}