Hi all,

This patch makes the default DllMain call DisableThreadLibraryCalls. There is nothing in
dllcrt1.c that depends on DLL_THREAD_ATTACH or DLL_THREAD_DETACH,
so I think it is pretty safe.

Does anyone see a problem?

Cheers,
Pedro Alves

src/mingw/ChangeLog.mingw32ce:
2006-11-27  Pedro Alves  <[EMAIL PROTECTED]>

       * dllmain.c: Call DisableThreadLibraryCalls on DLL_PROCESS_ATTACH.

Index: dllmain.c
===================================================================
--- dllmain.c   (revision 827)
+++ dllmain.c   (working copy)
@@ -14,6 +14,14 @@
 BOOL WINAPI 
 DllMain (HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
 {
+  if (dwReason == DLL_PROCESS_ATTACH)
+  {
+    /* Since the user didn't supply a DllMain, we might as well
+       suppress calls to it on thread creation and destruction
+       (DLL_THREAD_ATTACH and DLL_THREAD_DETACH notifications). 
+       Besides the speed optimization, this avoids paging
+       in DllMain, thus reducing it's working code set.  */
+    DisableThreadLibraryCalls (hDll);
+  }
   return TRUE;
 }
-
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to