From 9835e18f641196f9fe4a1c14fb17f1a988ecc548 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Wed, 1 Jun 2016 15:07:16 +0200 Subject: [PATCH] Fix compilation with mingw64 using autotools --- include/zmq.h | 14 ++++++++++++++ src/fd.hpp | 4 ++++ src/reaper.cpp | 2 +- src/select.cpp | 2 +- src/socket_base.cpp | 2 +- src/socks_connecter.cpp | 2 +- src/stream_engine.cpp | 2 +- src/tcp_connecter.cpp | 2 +- src/tcp_listener.cpp | 2 +- src/udp_engine.cpp | 2 +- 10 files changed, 26 insertions(+), 8 deletions(-) diff --git a/include/zmq.h b/include/zmq.h index 06e456bc..5f35d191 100644 --- a/include/zmq.h +++ b/include/zmq.h @@ -58,6 +58,20 @@ extern "C" { #include #include #if defined _WIN32 +// Set target version to Windows Server 2008, Windows Vista or higher. +// Windows XP (0x0501) is supported but without client & server socket types. +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 +#endif + +#ifdef __MINGW32__ +// Require Windows XP or higher with MinGW for getaddrinfo(). +#if(_WIN32_WINNT >= 0x0600) +#else +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 +#endif +#endif #include #endif diff --git a/src/fd.hpp b/src/fd.hpp index 207b072e..b7f7ad6a 100644 --- a/src/fd.hpp +++ b/src/fd.hpp @@ -30,6 +30,10 @@ #ifndef __ZMQ_FD_HPP_INCLUDED__ #define __ZMQ_FD_HPP_INCLUDED__ +#if defined _WIN32 +#include +#endif + namespace zmq { #ifdef ZMQ_HAVE_WINDOWS diff --git a/src/reaper.cpp b/src/reaper.cpp index 6d4c5949..82935b64 100644 --- a/src/reaper.cpp +++ b/src/reaper.cpp @@ -35,7 +35,7 @@ zmq::reaper_t::reaper_t (class ctx_t *ctx_, uint32_t tid_) : object_t (ctx_, tid_), - mailbox_handle(NULL), + mailbox_handle((poller_t::handle_t)NULL), sockets (0), terminating (false) { diff --git a/src/select.cpp b/src/select.cpp index fc35e2cf..c9fcef12 100644 --- a/src/select.cpp +++ b/src/select.cpp @@ -277,7 +277,7 @@ void zmq::select_t::loop () if (family_entries.size () > 1) { rc = WSAWaitForMultipleEvents (4, wsa_events.events, FALSE, timeout ? timeout : INFINITE, FALSE); - wsa_assert (rc != WSA_WAIT_FAILED); + wsa_assert (rc != (int)WSA_WAIT_FAILED); zmq_assert (rc != WSA_WAIT_IO_COMPLETION); if (rc == WSA_WAIT_TIMEOUT) diff --git a/src/socket_base.cpp b/src/socket_base.cpp index 21b48b49..73f90120 100644 --- a/src/socket_base.cpp +++ b/src/socket_base.cpp @@ -194,7 +194,7 @@ zmq::socket_base_t::socket_base_t (ctx_t *parent_, uint32_t tid_, int sid_, bool ctx_terminated (false), destroyed (false), poller(NULL), - handle(NULL), + handle((poller_t::handle_t)NULL), last_tsc (0), ticks (0), rcvmore (false), diff --git a/src/socks_connecter.cpp b/src/socks_connecter.cpp index f8ac57ca..e56eb6ed 100644 --- a/src/socks_connecter.cpp +++ b/src/socks_connecter.cpp @@ -58,7 +58,7 @@ zmq::socks_connecter_t::socks_connecter_t (class io_thread_t *io_thread_, proxy_addr (proxy_addr_), status (unplugged), s (retired_fd), - handle(NULL), + handle((handle_t)NULL), handle_valid(false), delayed_start (delayed_start_), timer_started(false), diff --git a/src/stream_engine.cpp b/src/stream_engine.cpp index fa7b0322..ca1cdab9 100644 --- a/src/stream_engine.cpp +++ b/src/stream_engine.cpp @@ -61,7 +61,7 @@ zmq::stream_engine_t::stream_engine_t (fd_t fd_, const options_t &options_, const std::string &endpoint_) : s (fd_), as_server(false), - handle(NULL), + handle((handle_t)NULL), inpos (NULL), insize (0), decoder (NULL), diff --git a/src/tcp_connecter.cpp b/src/tcp_connecter.cpp index 95a778db..64691af6 100644 --- a/src/tcp_connecter.cpp +++ b/src/tcp_connecter.cpp @@ -64,7 +64,7 @@ zmq::tcp_connecter_t::tcp_connecter_t (class io_thread_t *io_thread_, io_object_t (io_thread_), addr (addr_), s (retired_fd), - handle(NULL), + handle((handle_t)NULL), handle_valid (false), delayed_start (delayed_start_), connect_timer_started (false), diff --git a/src/tcp_listener.cpp b/src/tcp_listener.cpp index f6629517..eac7f423 100644 --- a/src/tcp_listener.cpp +++ b/src/tcp_listener.cpp @@ -62,7 +62,7 @@ zmq::tcp_listener_t::tcp_listener_t (io_thread_t *io_thread_, own_t (io_thread_, options_), io_object_t (io_thread_), s (retired_fd), - handle(NULL), + handle((handle_t)NULL), socket (socket_) { } diff --git a/src/udp_engine.cpp b/src/udp_engine.cpp index 25b37271..6e7b2511 100644 --- a/src/udp_engine.cpp +++ b/src/udp_engine.cpp @@ -47,7 +47,7 @@ zmq::udp_engine_t::udp_engine_t(const options_t &options_) : plugged (false), fd(-1), session(NULL), - handle(NULL), + handle((handle_t)NULL), address(NULL), options(options_), send_enabled(false),