Skip to content

Commit

Permalink
Move WINVER definition before other includes (stephane#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephane authored and georgidimov committed Jul 24, 2017
1 parent c673403 commit c4dffeb
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/modbus-tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
* SPDX-License-Identifier: LGPL-2.1+
*/

#if defined(_WIN32)
# define OS_WIN32
/* ws2_32.dll has getaddrinfo and freeaddrinfo on Windows XP and later.
* minwg32 headers check WINVER before allowing the use of these */
# ifndef WINVER
# define WINVER 0x0501
# endif
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand All @@ -15,12 +24,6 @@
#include <sys/types.h>

#if defined(_WIN32)
# define OS_WIN32
/* ws2_32.dll has getaddrinfo and freeaddrinfo on Windows XP and later.
* minwg32 headers check WINVER before allowing the use of these */
# ifndef WINVER
# define WINVER 0x0501
# endif
/* Already set in modbus-tcp.h but it seems order matters in VS2005 */
# include <winsock2.h>
# include <ws2tcpip.h>
Expand Down

0 comments on commit c4dffeb

Please sign in to comment.