Call DllMain entry point if declared

This commit is contained in:
syscall0 2019-11-24 19:37:56 +03:00 committed by Andrew Kelley
parent 6109e49c5b
commit eea8b10463

View File

@ -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;
}