[omniORB] RE: Colliding defines when using VS2010 and OpenSSL

Peter Klotz Peter.Klotz at ith-icoserve.com
Sat Mar 26 10:18:15 GMT 2011


Hello Duncan

On second thought I would also recommend to use something like OMNI_EINPROGRESS instead of EINPROGRESS to avoid the DEFINE collision in the first place.

The changed include order works but it is a fragile fix.

Regards, Peter.


> -----Original Message-----
> From: omniorb-list-bounces at omniorb-support.com [mailto:omniorb-list-bounces at omniorb-support.com] On
> Behalf Of Peter Klotz
> Sent: Friday, March 25, 2011 12:10 PM
> To: omniorb-list at omniorb-support.com
> Subject: [omniORB] Colliding defines when using VS2010 and OpenSSL
> 
> Hello
> 
> Using omniORB 4.1.5 with Visual Studio 2010 and OpenSSL 1.0.0d results in non working binaries.
> 
> The reason is a duplicate DEFINE and an unfortunate include order. The attached patch fixes the
> problem by changing the include order, the duplicate DEFINE remains.
> 
> When compiling omniORB one encounters this warning:
> 
> E:\VS2010\include\errno.h(104) : warning C4005: 'EINPROGRESS' : macro redefinition
>         C:\omniORB-4.1.5\include\omniORB4\internal\SocketCollection.h(220) :
> see previous definition of 'EINPROGRESS'
> 
> 
> Since VS2010 the DEFINE EINPROGRESS exists in errno.h with value 112. In SocketCollection.h omniORB
> defines EINPROGRESS to be replaced by WSAEWOULDBLOCK in Windows. WSAEWOULDBLOCK has value 10035
> according to WinSock2.h.
> 
> After connect() calls, the resulting error value is compared with EINPROGRESS. That case happens
> very often when using non-blocking sockets.
> 
> Due to the duplicate DEFINE the error value is compared with 112 instead of 10035 and the socket is
> immediately closed.
> 
> The problem only occurs when using SSL connections, due to this include order (obtained using
> compiler flag /showIncludes when compiling sslTransportImpl.cc):
> 
> Note: including file: C:\omniORB-4.1.5\src\lib\omniORB\orbcore\ssl/sslConnection.h
> Note: including file:  C:\omniORB-4.1.5\include\omniORB4\internal\SocketCollection.h
> ...
> Note: including file: c:\OpenSSL-1.0.0d\include\openssl/err.h
> ...
> Note: including file:  E:\devel\ICOMPILER\win32\cl1600\include\errno.h
> E:\devel\ICOMPILER\win32\cl1600\include\errno.h(104) : warning C4005: 'EINPROGRESS' : macro
> redefinition
>         C:\omniORB-4.1.5\include\omniORB4\internal\SocketCollection.h(220) : see previous
> definition of 'EINPROGRESS'
> 
> First SocketCollection.h is included by sslConnection.h and later errno.h is included by
> openssl/err.h.
> 
> The attached patch changes the include order in all 4 source files (sslAddress.cc, sslContext.cc,
> sslEndpoint.cc, sslTransportImpl.cc) that include openssl/err.h. So it is ensured that EINPROGRESS
> finally equal 10035, not 112.
> 
> Regards, Peter.



More information about the omniORB-list mailing list