Commit 7acb7eaa00fb1409e8de23e13bc0fb11c3f59c91
1 parent
c3742e73
Move WINVER definition before other includes (#350)
Showing
1 changed file
with
9 additions
and
6 deletions
src/modbus-tcp.c
| ... | ... | @@ -4,6 +4,15 @@ |
| 4 | 4 | * SPDX-License-Identifier: LGPL-2.1+ |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | +#if defined(_WIN32) | |
| 8 | +# define OS_WIN32 | |
| 9 | +/* ws2_32.dll has getaddrinfo and freeaddrinfo on Windows XP and later. | |
| 10 | + * minwg32 headers check WINVER before allowing the use of these */ | |
| 11 | +# ifndef WINVER | |
| 12 | +# define WINVER 0x0501 | |
| 13 | +# endif | |
| 14 | +#endif | |
| 15 | + | |
| 7 | 16 | #include <stdio.h> |
| 8 | 17 | #include <stdlib.h> |
| 9 | 18 | #include <string.h> |
| ... | ... | @@ -15,12 +24,6 @@ |
| 15 | 24 | #include <sys/types.h> |
| 16 | 25 | |
| 17 | 26 | #if defined(_WIN32) |
| 18 | -# define OS_WIN32 | |
| 19 | -/* ws2_32.dll has getaddrinfo and freeaddrinfo on Windows XP and later. | |
| 20 | - * minwg32 headers check WINVER before allowing the use of these */ | |
| 21 | -# ifndef WINVER | |
| 22 | -# define WINVER 0x0501 | |
| 23 | -# endif | |
| 24 | 27 | /* Already set in modbus-tcp.h but it seems order matters in VS2005 */ |
| 25 | 28 | # include <winsock2.h> |
| 26 | 29 | # include <ws2tcpip.h> | ... | ... |