[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-dev] common/aes.c troubles



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
_______________________________________________
tor-dev mailing list
tor-dev@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev