From eea8b10463b944dae5434e748c9a5b67c2287bea Mon Sep 17 00:00:00 2001 From: syscall0 Date: Sun, 24 Nov 2019 19:37:56 +0300 Subject: [PATCH] Call DllMain entry point if declared --- lib/std/special/start_lib.zig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/std/special/start_lib.zig b/lib/std/special/start_lib.zig index 701eee389d..994bc14fd5 100644 --- 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; }