[m-rev.] diff: [net] Include mercury_windows.h before winsock2.h
Paul Bone
paul at bone.id.au
Wed Jan 14 10:21:13 AEDT 2015
Branches: master
---
[net] Include mercury_windows.h before winsock2.h
To make winsock2.h useable we have to include mercury_windows first,
which includes windows.h in such a way as not to include the conflicting
winsock.h.
Julien caught this bug in my previous commit. Thanks.
extras/net/netdb.m:
extras/net/sockets.m:
extras/net/tcp.m:
extras/net/types.m:
As above.
---
extras/net/netdb.m | 1 +
extras/net/sockets.m | 15 ++++++++-------
extras/net/tcp.m | 27 ++++++++++++++-------------
extras/net/types.m | 1 +
4 files changed, 24 insertions(+), 20 deletions(-)
diff --git a/extras/net/netdb.m b/extras/net/netdb.m
index fe5ab15..2d1cc43 100644
--- a/extras/net/netdb.m
+++ b/extras/net/netdb.m
@@ -83,6 +83,7 @@
:- pragma foreign_decl("C",
"
#ifdef MR_WIN32
+ #include ""mercury_windows.h""
#include <winsock2.h>
#include <ws2tcpip.h>
#else
diff --git a/extras/net/sockets.m b/extras/net/sockets.m
index 71f7dad..e6f3897 100644
--- a/extras/net/sockets.m
+++ b/extras/net/sockets.m
@@ -134,14 +134,15 @@
:- pragma foreign_decl("C",
"
#ifdef MR_WIN32
- #include <winsock2.h>
- #include <ws2tcpip.h>
+ #include ""mercury_windows.h""
+ #include <winsock2.h>
+ #include <ws2tcpip.h>
#else
- #include <errno.h>
- #include <netdb.h>
- #include <netinet/in.h>
- #include <sys/types.h>
- #include <sys/socket.h>
+ #include <errno.h>
+ #include <netdb.h>
+ #include <netinet/in.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
#endif
").
diff --git a/extras/net/tcp.m b/extras/net/tcp.m
index b25b3f8..0a96b62 100644
--- a/extras/net/tcp.m
+++ b/extras/net/tcp.m
@@ -171,27 +171,28 @@ tcp.shutdown(tcp(_, Handle), !IO) :-
:- pragma foreign_decl("C", "
#ifdef MR_WIN32
- #include <winsock2.h>
- #include <ws2tcpip.h>
- #include <sys/types.h>
+ #include ""mercury_windows.h""
+ #include <winsock2.h>
+ #include <ws2tcpip.h>
+ #include <sys/types.h>
- #define ML_error() WSAGetLastError()
+ #define ML_error() WSAGetLastError()
#else /* !MR_WIN32 */
- #include <errno.h>
- #include <unistd.h>
- #include <netdb.h>
+ #include <errno.h>
+ #include <unistd.h>
+ #include <netdb.h>
- #include <netinet/in.h>
+ #include <netinet/in.h>
- #include <sys/types.h>
- #include <sys/socket.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
- #define ML_error() errno
+ #define ML_error() errno
- #define INVALID_SOCKET -1
- #define SOCKET_ERROR -1
+ #define INVALID_SOCKET -1
+ #define SOCKET_ERROR -1
#endif /* !MR_WIN32 */
#define ADDRLEN 16
diff --git a/extras/net/types.m b/extras/net/types.m
index 966bff5..e0e49d5 100644
--- a/extras/net/types.m
+++ b/extras/net/types.m
@@ -95,6 +95,7 @@
:- pragma foreign_decl("C",
"
#ifdef MR_WIN32
+ #include ""mercury_windows.h""
#include <winsock2.h>
#include <ws2tcpip.h>
#else
--
2.1.3
More information about the reviews
mailing list