Function with name DllEntryPoint is entry point of the DLL library,
an alternative or aliased name to DllMainCRTStartup. So calling entry point
(DllEntryPoint) from entry point (DllMainCRTStartup) is just wrong.

Default DLL entry point function varies between compilers/linkers.
Borland C uses DllEntryPoint, GNU LD uses DllMainCRTStartup, MSVC link.exe
uses _DllMainCRTStartup.

The DLL application start function has same name DllMain.

Anyway, if the application is using own custom DLL entry point then it has
to pass appropriate compiler / linker parameters to omit inclusion of
standard library and/or startup files. Therefore removal of DllEntryPoint
should not cause big issues.
---
 mingw-w64-crt/Makefile.am          |  2 +-
 mingw-w64-crt/crt/crtdll.c         | 16 ++--------------
 mingw-w64-crt/misc/dllentrypoint.c | 18 ------------------
 3 files changed, 3 insertions(+), 33 deletions(-)
 delete mode 100644 mingw-w64-crt/misc/dllentrypoint.c

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 7f8841a85f3f..51f660985f42 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -912,7 +912,7 @@ src_msvcr120_app=\
 src_libmingwex=\
   cfguard/mingw_cfguard_support.c \
   \
-  misc/dllentrypoint.c misc/dllmain.c \
+  misc/dllmain.c \
   \
   complex/_cabs.c    complex/cabs.c   complex/cabsf.c   complex/cabsl.c   
complex/cacos.c   complex/cacosf.c   \
   complex/cacosl.c   complex/carg.c   complex/cargf.c   complex/cargl.c   
complex/casin.c   complex/casinf.c   \
diff --git a/mingw-w64-crt/crt/crtdll.c b/mingw-w64-crt/crt/crtdll.c
index d63915ca30a3..6bee08f596ab 100644
--- a/mingw-w64-crt/crt/crtdll.c
+++ b/mingw-w64-crt/crt/crtdll.c
@@ -38,8 +38,6 @@ static _onexit_table_t atexit_table;
 
 extern int __mingw_app_type;
 
-extern WINBOOL WINAPI DllEntryPoint (HANDLE, DWORD, LPVOID);
-
 WINBOOL WINAPI _CRT_INIT (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
 {
   if (dwReason == DLL_PROCESS_DETACH)
@@ -140,7 +138,7 @@ WINBOOL WINAPI DllMainCRTStartup (HANDLE, DWORD, LPVOID);
 
 #if defined(__i386__) || defined(_X86_)
 /* We need to make sure that we align the stack to 16 bytes for the sake of SSE
-   opts in DllMain/DllEntryPoint or in functions called from 
DllMain/DllEntryPoint.  */
+   opts in DllMain or in functions called from DllMain.  */
 __attribute__((force_align_arg_pointer))
 #endif
 __attribute__((used)) /* required due to GNU LD bug: 
https://sourceware.org/bugzilla/show_bug.cgi?id=30300 */
@@ -162,26 +160,16 @@ DllMainCRTStartup (HANDLE hDllHandle, DWORD dwReason, 
LPVOID lpreserved)
         retcode = _CRT_INIT (hDllHandle, dwReason, lpreserved);
         if (!retcode)
           goto i__leave;
-        retcode = DllEntryPoint (hDllHandle, dwReason, lpreserved);
-       if (! retcode)
-         {
-           if (dwReason == DLL_PROCESS_ATTACH)
-             _CRT_INIT (hDllHandle, DLL_PROCESS_DETACH, lpreserved);
-           goto i__leave;
-         }
     }
   retcode = DllMain(hDllHandle,dwReason,lpreserved);
   if (dwReason == DLL_PROCESS_ATTACH && ! retcode)
     {
        DllMain (hDllHandle, DLL_PROCESS_DETACH, lpreserved);
-       DllEntryPoint (hDllHandle, DLL_PROCESS_DETACH, lpreserved);
        _CRT_INIT (hDllHandle, DLL_PROCESS_DETACH, lpreserved);
     }
   if (dwReason == DLL_PROCESS_DETACH || dwReason == DLL_THREAD_DETACH)
     {
-        retcode = DllEntryPoint (hDllHandle, dwReason, lpreserved);
-       if (_CRT_INIT (hDllHandle, dwReason, lpreserved) == FALSE)
-         retcode = FALSE;
+       retcode = _CRT_INIT (hDllHandle, dwReason, lpreserved);
     }
 i__leave:
   __native_dllmain_reason = UINT_MAX;
diff --git a/mingw-w64-crt/misc/dllentrypoint.c 
b/mingw-w64-crt/misc/dllentrypoint.c
deleted file mode 100644
index 0e3581ba67e6..000000000000
--- a/mingw-w64-crt/misc/dllentrypoint.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * This file has no copyright assigned and is placed in the Public Domain.
- * This file is part of the mingw-w64 runtime package.
- * No warranty is given; refer to the file DISCLAIMER.PD within this package.
- */
-
-#include <oscalls.h>
-#define _DECL_DLLMAIN
-#include <process.h>
-
-BOOL WINAPI DllEntryPoint (HANDLE, DWORD, LPVOID);
-
-BOOL WINAPI DllEntryPoint (HANDLE __UNUSED_PARAM(hDllHandle),
-                          DWORD  __UNUSED_PARAM(dwReason),
-                          LPVOID __UNUSED_PARAM(lpreserved))
-{
-  return TRUE;
-}
-- 
2.20.1



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to