You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Martin Sebor <se...@roguewave.com> on 2008/06/27 20:39:08 UTC

Re: svn commit: r671547 - /stdcxx/branches/4.2.x/include/rw/_mutex.h

faridz@apache.org wrote:
> Author: faridz
> Date: Wed Jun 25 06:28:27 2008
> New Revision: 671547
> 
> URL: http://svn.apache.org/viewvc?rev=671547&view=rev
> Log:
> 2008-06-25  Farid Zaripov  <fa...@epam.com>
> 
> 	* include/rw/_mutex.h: #define WIN32_LEAN_AND_MEAN before #including <windows.h>
> 	to prevent #including unneeded headers, especially <winsock.h>, that causes an
> 	"WinSock.h has already been included" errors when <winsock2.h> has been #included
> 	after <rw/_mutex.h>.

I don't think we want to do this. Users might want to
#include the fat and flabby <windows.h> after they #include
one of our headers. If #undef-ining WIN32_LEAN_AND_MEAN after
#including <windows.h> here users can #include <windows.h>
again and get the rest of the junk defined there that would
be a possible solution. Otherwise we need to revert.

Martin

> 
> Modified:
>     stdcxx/branches/4.2.x/include/rw/_mutex.h
> 
> Modified: stdcxx/branches/4.2.x/include/rw/_mutex.h
> URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_mutex.h?rev=671547&r1=671546&r2=671547&view=diff
> ==============================================================================
> --- stdcxx/branches/4.2.x/include/rw/_mutex.h (original)
> +++ stdcxx/branches/4.2.x/include/rw/_mutex.h Wed Jun 25 06:28:27 2008
> @@ -124,6 +124,10 @@
>  
>  #  ifdef _RWSTD_NO_FWD_DECLARATIONS
>  
> +     // prevent #including unneeded headers, i.e. <winsock.h> because
> +     // this causes the error "WinSock.h has already been included"
> +     // when <winsock2.h> has been included after this header
> +#    define WIN32_LEAN_AND_MEAN
>  #    include <windows.h>
>  #    define _RWSTD_MUTEX_T _RTL_CRITICAL_SECTION
>  
> 
> 


Re: svn commit: r671547 - /stdcxx/branches/4.2.x/include/rw/_mutex.h

Posted by Martin Sebor <se...@roguewave.com>.
Farid Zaripov wrote:
>> -----Original Message-----
>> From: Martin Sebor [mailto:sebor@roguewave.com] 
>> Sent: Friday, June 27, 2008 9:39 PM
>> To: dev@stdcxx.apache.org
>> Subject: Re: svn commit: r671547 - 
>> /stdcxx/branches/4.2.x/include/rw/_mutex.h
>>
>> faridz@apache.org wrote:
>>> Author: faridz
>>> Date: Wed Jun 25 06:28:27 2008
>>> New Revision: 671547
>>>
>>> URL: http://svn.apache.org/viewvc?rev=671547&view=rev
>>> Log:
>>> 2008-06-25  Farid Zaripov  <fa...@epam.com>
>>>
>>> 	* include/rw/_mutex.h: #define WIN32_LEAN_AND_MEAN 
>> before #including <windows.h>
>>> 	to prevent #including unneeded headers, especially 
>> <winsock.h>, that causes an
>>> 	"WinSock.h has already been included" errors when 
>> <winsock2.h> has been #included
>>> 	after <rw/_mutex.h>.
>> I don't think we want to do this. Users might want to 
>> #include the fat and flabby <windows.h> after they #include 
>> one of our headers.
> 
>   But including <windows.h> in <rw/_mutex.h> without WIN32_LEAN_AND_MEAN
> defined
> causes an errors when user doesn't includes <windows.h>, but includes
> <winsock2.h> after
> our library header, that including <rw/_mutex.h> (i.e. <istream>).
> 
>   Due to this issue the most of boost/asio regression tests are failed
> to compile on 64-bit MSVC:

We had problems caused by <windows.h> in the past. IIRC,
we solved them by forward declaring some of the functions
that we needed. Is this not being done anymore? Or if we
cannot do this for some reason, is there some saner
header than <windows.h> that we could #include instead?
If not, we might need to insulate rw/_mutex.h from all
this windows garbage by defining all the functions we
need out of line and #including <windows.h> in some
.cpp file.

Martin

> http://beta.boost.org/development/tests/trunk/developer/output/msvc-9-0-
> x64-stdcxx-4-2-2-boost-bin-v2-libs-asio-test-basic_datagram_socket-test-
> msvc-9-0_stdcxx_422-debug-address-model-64-architecture-x86-stdlib-stdcx
> x-4-2-2-threading-multi.html
> 
>> If #undef-ining WIN32_LEAN_AND_MEAN after 
>> #including <windows.h> here users can #include <windows.h> 
>> again and get the rest of the junk defined there that would 
>> be a possible solution.
> 
>   Unfortunately this doesn't works.
> 
>> Otherwise we need to revert.
> 
>   Ok, I'll revert this change along with deleting of the #define
> _RWSTD_NO_FWD_DECLARATIONS
> in <rw/_config-msvcrt.h>.
> 
> Farid.


RE: svn commit: r671547 - /stdcxx/branches/4.2.x/include/rw/_mutex.h

Posted by Farid Zaripov <Fa...@epam.com>.
> -----Original Message-----
> From: Martin Sebor [mailto:sebor@roguewave.com] 
> Sent: Friday, June 27, 2008 9:39 PM
> To: dev@stdcxx.apache.org
> Subject: Re: svn commit: r671547 - 
> /stdcxx/branches/4.2.x/include/rw/_mutex.h
> 
> faridz@apache.org wrote:
> > Author: faridz
> > Date: Wed Jun 25 06:28:27 2008
> > New Revision: 671547
> > 
> > URL: http://svn.apache.org/viewvc?rev=671547&view=rev
> > Log:
> > 2008-06-25  Farid Zaripov  <fa...@epam.com>
> > 
> > 	* include/rw/_mutex.h: #define WIN32_LEAN_AND_MEAN 
> before #including <windows.h>
> > 	to prevent #including unneeded headers, especially 
> <winsock.h>, that causes an
> > 	"WinSock.h has already been included" errors when 
> <winsock2.h> has been #included
> > 	after <rw/_mutex.h>.
> 
> I don't think we want to do this. Users might want to 
> #include the fat and flabby <windows.h> after they #include 
> one of our headers.

  But including <windows.h> in <rw/_mutex.h> without WIN32_LEAN_AND_MEAN
defined
causes an errors when user doesn't includes <windows.h>, but includes
<winsock2.h> after
our library header, that including <rw/_mutex.h> (i.e. <istream>).

  Due to this issue the most of boost/asio regression tests are failed
to compile on 64-bit MSVC:
http://beta.boost.org/development/tests/trunk/developer/output/msvc-9-0-
x64-stdcxx-4-2-2-boost-bin-v2-libs-asio-test-basic_datagram_socket-test-
msvc-9-0_stdcxx_422-debug-address-model-64-architecture-x86-stdlib-stdcx
x-4-2-2-threading-multi.html

> If #undef-ining WIN32_LEAN_AND_MEAN after 
> #including <windows.h> here users can #include <windows.h> 
> again and get the rest of the junk defined there that would 
> be a possible solution.

  Unfortunately this doesn't works.

> Otherwise we need to revert.

  Ok, I'll revert this change along with deleting of the #define
_RWSTD_NO_FWD_DECLARATIONS
in <rw/_config-msvcrt.h>.

Farid.