Commit 3fb246237df40e25ed9e1c24a34c0779778e79e6

Authored by Stéphane Raimbault
1 parent e6349372

Fix compilation issue with Microsoft Visual Studio 2008

Reported by Allan Cornet.
README.rst
... ... @@ -26,6 +26,9 @@ Installation
26 26  
27 27 The shell commands are ``./autogen.sh; ./configure; make; make install``.
28 28  
  29 +If you want to compile with Microsoft Visual Studio, you need to install
  30 +http://code.google.com/p/msinttypes/ to fill the absence of stdint.h.
  31 +
29 32 Testing
30 33 -------
31 34  
... ...
src/modbus-data.c
... ... @@ -16,7 +16,11 @@
16 16 */
17 17  
18 18 #include <stdlib.h>
  19 +#ifndef _MSC_VER
19 20 #include <stdint.h>
  21 +#else
  22 +#include "stdint.h"
  23 +#endif
20 24 #include <string.h>
21 25 #include <assert.h>
22 26 #include <netinet/in.h>
... ...
src/modbus-private.h
... ... @@ -18,11 +18,16 @@
18 18 #ifndef _MODBUS_PRIVATE_H_
19 19 #define _MODBUS_PRIVATE_H_
20 20  
21   -#include <sys/time.h>
  21 +#ifndef _MSC_VER
  22 +# include <stdint.h>
  23 +# include <sys/time.h>
  24 +#else
  25 +# include "stdint.h"
  26 +# include <time.h>
  27 +#endif
22 28 #include <sys/types.h>
23   -#include <stdint.h>
24   -
25 29 #include <config.h>
  30 +
26 31 #include "modbus.h"
27 32  
28 33 MODBUS_BEGIN_DECLS
... ...
src/modbus-rtu-private.h
... ... @@ -18,7 +18,11 @@
18 18 #ifndef _MODBUS_RTU_PRIVATE_H_
19 19 #define _MODBUS_RTU_PRIVATE_H_
20 20  
  21 +#ifndef _MSC_VER
21 22 #include <stdint.h>
  23 +#else
  24 +#include "stdint.h"
  25 +#endif
22 26  
23 27 #if defined(_WIN32)
24 28 #include <windows.h>
... ...
src/modbus-rtu.c
... ... @@ -20,7 +20,9 @@
20 20 #include <errno.h>
21 21 #include <fcntl.h>
22 22 #include <string.h>
  23 +#ifndef _MSC_VER
23 24 #include <unistd.h>
  25 +#endif
24 26 #include <assert.h>
25 27  
26 28 #include "modbus-private.h"
... ...
src/modbus-tcp.c
... ... @@ -19,7 +19,9 @@
19 19 #include <stdlib.h>
20 20 #include <string.h>
21 21 #include <errno.h>
  22 +#ifndef _MSC_VER
22 23 #include <unistd.h>
  24 +#endif
23 25 #include <signal.h>
24 26 #include <sys/types.h>
25 27  
... ...
src/modbus.c
... ... @@ -22,7 +22,9 @@
22 22 #include <stdio.h>
23 23 #include <string.h>
24 24 #include <stdlib.h>
  25 +#ifndef _MSC_VER
25 26 #include <unistd.h>
  27 +#endif
26 28 #include <errno.h>
27 29 #include <limits.h>
28 30  
... ...
src/modbus.h
... ... @@ -23,8 +23,13 @@
23 23 #include <sys/param.h>
24 24 #endif
25 25  
  26 +#ifndef _MSC_VER
26 27 #include <stdint.h>
27 28 #include <sys/time.h>
  29 +#else
  30 +#include "stdint.h"
  31 +#include <time.h>
  32 +#endif
28 33  
29 34 #include "modbus-version.h"
30 35  
... ...
tests/unit-test.h
... ... @@ -24,7 +24,11 @@
24 24 #include <inttypes.h>
25 25 #endif
26 26 #ifdef HAVE_STDINT_H
27   -#include <stdint.h>
  27 +# ifndef _MSC_VER
  28 +# include <stdint.h>
  29 +# else
  30 +# include "stdint.h"
  31 +# endif
28 32 #endif
29 33  
30 34 #define SERVER_ID 17
... ...