Subject: Re: [boost] [pool] detail/mutex.hpp may include windows.h and pollute namespace with windows definitions.
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-10-05 12:19:01
On 10/5/2010 8:04 AM, Paul Blampspied wrote:
> I believe that the appropriate declarations of InitializeCriticalSection,
> DeleteCriticalSection, EnterCriticalSection, LeaveCriticalSection could be
> provided explicitly in this file and hence avoid
> including windows.h and the subsequent namespace 'pollution'. An
> alternative of using a Boost multithreading library is suggested in the
> documentation. This would be ideal, but my proposal would solve problem
> now, relatively effortlessly.
> PS. I did a quick edit and got it to work (at least on Vista). The change
> to the if-endif block is shown below. It could be done much better.
> # ifdef BOOST_WINDOWS
> typedef char CRITICAL_SECTION; //24 is sizeof(CRITICAL_SECTION) !
Can you guarantee that this is the correct size
on all systems? Are you sure that there are
no alignment problems?
> typedef CRITICAL_SECTION *LPCRITICAL_SECTION;
> #define WINAPI __stdcall
> extern void WINAPI InitializeCriticalSection(
> __out LPCRITICAL_SECTION lpCriticalSection
Does this actually link? I would think that it would
need to be extern "C".