[Gc] inclusion of windows.h

Romano Paolo Tenca rotenca at telvia.it
Tue Jul 10 03:11:14 PDT 2007


Boehm, Hans ha scritto:
> Thanks.
>
> But I guess I don't understand Windows conventions well enough to be
> convinced that either of these are an improvement.
>
> With (1), won't this be a problem if the file incluing gc.h later needs
> a full version of windows.h?
>
>   
Yes, you are right.

> With (2), can't you get a similar effect by defining WIN32_LEAN_AND_MEAN
> and NOSERVICE before including gc.h?  And I think I prefer that, since
> it doesn't risk accidentally not redefining some of the threads
> primitives.  Perhaps the right solution is just to document that
> behavior?
>
>   
I was not clear about 2. This is what i mean (i tested it a little only 
in my program - i did not check if there are some side effects when 
compiling gc itself):

#define GC_NO_CREATETHREAD
#include gc.h

in gc.h

# ifndef GC_NO_CREATETHREAD
    # include <windows.h>
# endif

[...]

# ifndef GC_NO_CREATETHREAD
   GC_API HANDLE WINAPI GC_CreateThread(
      LPSECURITY_ATTRIBUTES lpThreadAttributes,
      DWORD dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress,
      LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId );

   GC_API void WINAPI GC_ExitThread(DWORD dwExitCode);
# endif

[...]

# ifndef GC_NO_CREATETHREAD
#  define CreateThread GC_CreateThread
#  define ExitThread GC_ExitThread
# endif

-- 
Romano Paolo Tenca



More information about the Gc mailing list