Commit 680e90f4176b78583e956bbe985952c99f9abf6d

Authored by Stéphane Raimbault
1 parent c2d93bb0

Fix #224485 reported by Todd Denniston

libmodbus does not link with c++ code.
Showing 2 changed files with 10 additions and 0 deletions
@@ -27,6 +27,8 @@ libmodbus 1.9.x @@ -27,6 +27,8 @@ libmodbus 1.9.x
27 modbus.h is not installed at prefix. 27 modbus.h is not installed at prefix.
28 - Fix #211460 reported by Todd Denniston 28 - Fix #211460 reported by Todd Denniston
29 With TCP, automatic reconnect on error may not be desired. 29 With TCP, automatic reconnect on error may not be desired.
  30 +- Fix #224485 reported by Todd Denniston
  31 + libmodbus does not link with c++ code.
30 32
31 libmodbus 1.2.4 (2008-03-14) 33 libmodbus 1.2.4 (2008-03-14)
32 - Fix #191039 reported by Todd Denniston 34 - Fix #191039 reported by Todd Denniston
modbus/modbus.h
@@ -24,6 +24,10 @@ @@ -24,6 +24,10 @@
24 #include <termios.h> 24 #include <termios.h>
25 #include <arpa/inet.h> 25 #include <arpa/inet.h>
26 26
  27 +#ifdef __cplusplus
  28 +extern "C" {
  29 +#endif
  30 +
27 #define MODBUS_TCP_DEFAULT_PORT 502 31 #define MODBUS_TCP_DEFAULT_PORT 502
28 32
29 #define HEADER_LENGTH_RTU 0 33 #define HEADER_LENGTH_RTU 0
@@ -303,4 +307,8 @@ void set_bits_from_bytes(uint8_t *dest, int address, int nb_bits, @@ -303,4 +307,8 @@ void set_bits_from_bytes(uint8_t *dest, int address, int nb_bits,
303 To obtain a full byte, set nb_bits to 8. */ 307 To obtain a full byte, set nb_bits to 8. */
304 uint8_t get_byte_from_bits(const uint8_t *src, int address, int nb_bits); 308 uint8_t get_byte_from_bits(const uint8_t *src, int address, int nb_bits);
305 309
  310 +#ifdef __cplusplus
  311 +}
  312 +#endif
  313 +
306 #endif /* _MODBUS_H_ */ 314 #endif /* _MODBUS_H_ */