This is the mail archive of the
pthreads-win32@sources.redhat.com
mailing list for the pthreas-win32 project.
#define WIN32_LEAN_AND_MEAN
- From: Steffen Goeldner <sgoeldner at cpan dot org>
- To: pthreads-win32 at sources dot redhat dot com
- Date: Mon, 20 Jun 2005 10:15:51 +0200
- Subject: #define WIN32_LEAN_AND_MEAN
To speed the build process, avoid possible name clashes etc.,
one #includes only necessary header files.
However, once you need <windows.h>, it opens the floodgates.
To exclude rarely-used Windows header files, I added
#define WIN32_LEAN_AND_MEAN 1
to implement.h, pthread.h and various test files - see
<http://support.microsoft.com/default.aspx?scid=kb;en-us;166474>
for details.
Now, we have to be explicit if we need additional Windows header
files, e.g. <winsock.h> in cancel9.c.
Similar for <stdlib.h>.
Steffen Goeldner
diff -ubr pthreads-w32-2-7-0-release-orig/implement.h pthreads-w32-2-7-0-release/implement.h
--- pthreads-w32-2-7-0-release-orig/implement.h Fri Jun 03 10:36:27 2005
+++ pthreads-w32-2-7-0-release/implement.h Fri Jun 17 15:02:14 2005
@@ -43,6 +43,7 @@
#endif
#define _WIN32_WINNT 0x400
+#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
/*
diff -ubr pthreads-w32-2-7-0-release-orig/pthread.h pthreads-w32-2-7-0-release/pthread.h
--- pthreads-w32-2-7-0-release-orig/pthread.h Fri Jun 03 10:36:28 2005
+++ pthreads-w32-2-7-0-release/pthread.h Fri Jun 17 15:02:50 2005
@@ -195,6 +195,7 @@
#endif
#ifdef PTW32_INCLUDE_WINDOWS_H
+#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#endif
diff -ubr pthreads-w32-2-7-0-release-orig/tests/benchlib.c pthreads-w32-2-7-0-release/tests/benchlib.c
--- pthreads-w32-2-7-0-release-orig/tests/benchlib.c Sat Jan 01 15:36:18 2005
+++ pthreads-w32-2-7-0-release/tests/benchlib.c Fri Jun 17 15:39:36 2005
@@ -37,8 +37,10 @@
#include "pthread.h"
#include "sched.h"
#include "semaphore.h"
+#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#include <stdio.h>
+#include <stdlib.h>
#ifdef __GNUC__
#include <stdlib.h>
diff -ubr pthreads-w32-2-7-0-release-orig/tests/cancel9.c pthreads-w32-2-7-0-release/tests/cancel9.c
--- pthreads-w32-2-7-0-release-orig/tests/cancel9.c Wed May 18 16:34:19 2005
+++ pthreads-w32-2-7-0-release/tests/cancel9.c Fri Jun 17 15:33:07 2005
@@ -73,7 +73,9 @@
*/
#include "test.h"
+#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
+#include <winsock.h>
void *
diff -ubr pthreads-w32-2-7-0-release-orig/tests/test.h pthreads-w32-2-7-0-release/tests/test.h
--- pthreads-w32-2-7-0-release-orig/tests/test.h Thu Apr 28 06:41:29 2005
+++ pthreads-w32-2-7-0-release/tests/test.h Fri Jun 17 15:27:55 2005
@@ -42,8 +42,10 @@
#include "sched.h"
#include "semaphore.h"
+#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#include <stdio.h>
+#include <stdlib.h>
#define PTW32_THREAD_NULL_ID {NULL,0}
diff -ubr pthreads-w32-2-7-0-release-orig/tests/tryentercs.c pthreads-w32-2-7-0-release/tests/tryentercs.c
--- pthreads-w32-2-7-0-release-orig/tests/tryentercs.c Sat Jan 01 15:36:19 2005
+++ pthreads-w32-2-7-0-release/tests/tryentercs.c Fri Jun 17 15:13:15 2005
@@ -37,6 +37,7 @@
* Does not use any part of pthreads.
*/
+#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#include <process.h>
#include <stdio.h>
diff -ubr pthreads-w32-2-7-0-release-orig/tests/tryentercs2.c pthreads-w32-2-7-0-release/tests/tryentercs2.c
--- pthreads-w32-2-7-0-release-orig/tests/tryentercs2.c Sat Jan 01 15:36:19 2005
+++ pthreads-w32-2-7-0-release/tests/tryentercs2.c Fri Jun 17 15:13:23 2005
@@ -37,6 +37,7 @@
* Does not use any part of pthreads.
*/
+#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#include <process.h>
#include <stdio.h>