crt: dll: Initialize __mingw_app_type only once

Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-crt/crt/crtdll.c b/mingw-w64-crt/crt/crtdll.c
index 6bee08f..a605c95 100644
--- a/mingw-w64-crt/crt/crtdll.c
+++ b/mingw-w64-crt/crt/crtdll.c
@@ -147,7 +147,9 @@
 {
   WINBOOL retcode = TRUE;
 
-  __mingw_app_type = 0;
+  if (dwReason == DLL_PROCESS_ATTACH)
+    __mingw_app_type = 0;
+
   __native_dllmain_reason = dwReason;
   if (dwReason == DLL_PROCESS_DETACH && __proc_attached <= 0)
     {