In common/aes.c:
#include "orconfig.h" #include <openssl/opensslv.h> ... #include <openssl/aes.h> .. #include "compat.h"
By default <winsock.h> is included in <windows.h> when WIN32_LEAN_AND_MEAN is not defined. But this is defined too late; in compat.h. So when <e_os.h> in OpenSSL pulls in <winsock.h> and <winsock2.h> gets included in compat.h, I'm getting lots of warnings and redefinitions errors. E.g.
g:\VC_2010\SDK\include\winsock.h(787) : see declaration of 'inet_ntoa' g:\VC_2010\SDK\include\winsock2.h(1815) : error C2375: 'listen' : redefinition; different linkage
An easy fix would be to move "#define WIN32_LEAN_AND_MEAN" into win32/orconfg.h:
diff --git a/src/common/compat.h b/src/common/compat.h index a228a46..5c66a11 100644 --- a/src/common/compat.h +++ b/src/common/compat.h @@ -15,7 +15,9 @@ #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x400 #endif +#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN +#endif #if defined(_MSC_VER) && (_MSC_VER < 1300) #include <winsock.h> #else
diff --git a/src/win32/orconfig.h b/src/win32/orconfig.h index e51b638..b9fe31f 100644 --- a/src/win32/orconfig.h +++ b/src/win32/orconfig.h @@ -5,6 +5,7 @@ /* Windows-only defines. */ #define MS_WINDOWS #define MS_WIN32 +#define WIN32_LEAN_AND_MEAN #define CONFDIR ""
/* Define to 1 if you have the <arpa/inet.h> header file. */
How about it?
--gv
On Wed, Dec 14, 2011 at 6:28 AM, Gisle Vanem gvanem@broadpark.no wrote:
How about it?
I'd say "not so good" if it only applies to MSVC builds. The orconfig.h files is supposed to correspond exactly to the one that would ordinarily be generated by the autoconf script for on other platforms.
Of course, if we patched the autoconf script so that it defined the macro when building on windows with mingw, that would be fine, since it would make the behavior consistent.
yrs,
"Nick Mathewson" nickm@alum.mit.edu wrote:
I'd say "not so good" if it only applies to MSVC builds.
I applies to all Win builds. Are you not getting any warnings and errors when compiling aes.c?
Of course, if we patched the autoconf script so that it defined the macro when building on windows with mingw, that would be fine, since it would make the behavior consistent.
Excactly. It wouldn't hurt to move WIN32_LEAN_AND_MEAN further up in the list of defines. It makes everyting compile faster too.
--gv
On Sun, Dec 18, 2011 at 7:46 AM, Gisle Vanem gvanem@broadpark.no wrote:
"Nick Mathewson" nickm@alum.mit.edu wrote:
I'd say "not so good" if it only applies to MSVC builds.
I applies to all Win builds. Are you not getting any warnings and errors when compiling aes.c?
I was referring to your idea of orconfig.h changes. The orconfig.h in src/win32 is only used by msvc.