浏览代码

Rename EXPORT by MODBUS_API

Stéphane Raimbault 11 年之前
父节点
当前提交
0b22e719c4
共有 3 个文件被更改,包括 55 次插入55 次删除
  1. 5 5
      src/modbus-rtu.h
  2. 6 6
      src/modbus-tcp.h
  3. 44 44
      src/modbus.h

+ 5 - 5
src/modbus-rtu.h

@@ -28,21 +28,21 @@ MODBUS_BEGIN_DECLS
  */
 #define MODBUS_RTU_MAX_ADU_LENGTH  256
 
-EXPORT modbus_t* modbus_new_rtu(const char *device, int baud, char parity,
+MODBUS_API modbus_t* modbus_new_rtu(const char *device, int baud, char parity,
                                 int data_bit, int stop_bit);
 
 #define MODBUS_RTU_RS232 0
 #define MODBUS_RTU_RS485 1
 
-EXPORT int modbus_rtu_set_serial_mode(modbus_t *ctx, int mode);
-EXPORT int modbus_rtu_get_serial_mode(modbus_t *ctx);
+MODBUS_API int modbus_rtu_set_serial_mode(modbus_t *ctx, int mode);
+MODBUS_API int modbus_rtu_get_serial_mode(modbus_t *ctx);
 
 #define MODBUS_RTU_RTS_NONE   0
 #define MODBUS_RTU_RTS_UP     1
 #define MODBUS_RTU_RTS_DOWN   2
 
-EXPORT int modbus_rtu_set_rts(modbus_t *ctx, int mode);
-EXPORT int modbus_rtu_get_rts(modbus_t *ctx);
+MODBUS_API int modbus_rtu_set_rts(modbus_t *ctx, int mode);
+MODBUS_API int modbus_rtu_get_rts(modbus_t *ctx);
 
 MODBUS_END_DECLS
 

+ 6 - 6
src/modbus-tcp.h

@@ -51,13 +51,13 @@ MODBUS_BEGIN_DECLS
  */
 #define MODBUS_TCP_MAX_ADU_LENGTH  260
 
-EXPORT modbus_t* modbus_new_tcp(const char *ip_address, int port);
-EXPORT int modbus_tcp_listen(modbus_t *ctx, int nb_connection);
-EXPORT int modbus_tcp_accept(modbus_t *ctx, int *s);
+MODBUS_API modbus_t* modbus_new_tcp(const char *ip_address, int port);
+MODBUS_API int modbus_tcp_listen(modbus_t *ctx, int nb_connection);
+MODBUS_API int modbus_tcp_accept(modbus_t *ctx, int *s);
 
-EXPORT modbus_t* modbus_new_tcp_pi(const char *node, const char *service);
-EXPORT int modbus_tcp_pi_listen(modbus_t *ctx, int nb_connection);
-EXPORT int modbus_tcp_pi_accept(modbus_t *ctx, int *s);
+MODBUS_API modbus_t* modbus_new_tcp_pi(const char *node, const char *service);
+MODBUS_API int modbus_tcp_pi_listen(modbus_t *ctx, int nb_connection);
+MODBUS_API int modbus_tcp_pi_accept(modbus_t *ctx, int *s);
 
 MODBUS_END_DECLS
 

+ 44 - 44
src/modbus.h

@@ -37,12 +37,12 @@
 #if defined(_MSC_VER)
 # if defined(DLLBUILD)
 /* define DLLBUILD when building the DLL */
-#  define EXPORT __declspec(dllexport)
+#  define MODBUS_API __declspec(dllexport)
 # else
-#  define EXPORT __declspec(dllimport)
+#  define MODBUS_API __declspec(dllimport)
 # endif
 #else
-# define EXPORT
+# define MODBUS_API
 #endif
 
 #ifdef  __cplusplus
@@ -154,57 +154,57 @@ typedef enum
     MODBUS_ERROR_RECOVERY_PROTOCOL      = (1<<2),
 } modbus_error_recovery_mode;
 
-EXPORT int modbus_set_slave(modbus_t* ctx, int slave);
-EXPORT int modbus_set_error_recovery(modbus_t *ctx, modbus_error_recovery_mode error_recovery);
-EXPORT int modbus_set_socket(modbus_t *ctx, int s);
-EXPORT int modbus_get_socket(modbus_t *ctx);
+MODBUS_API int modbus_set_slave(modbus_t* ctx, int slave);
+MODBUS_API int modbus_set_error_recovery(modbus_t *ctx, modbus_error_recovery_mode error_recovery);
+MODBUS_API int modbus_set_socket(modbus_t *ctx, int s);
+MODBUS_API int modbus_get_socket(modbus_t *ctx);
 
-EXPORT int modbus_get_response_timeout(modbus_t *ctx, struct timeval *timeout);
-EXPORT int modbus_set_response_timeout(modbus_t *ctx, const struct timeval *timeout);
+MODBUS_API int modbus_get_response_timeout(modbus_t *ctx, struct timeval *timeout);
+MODBUS_API int modbus_set_response_timeout(modbus_t *ctx, const struct timeval *timeout);
 
-EXPORT int modbus_get_byte_timeout(modbus_t *ctx, struct timeval *timeout);
-EXPORT int modbus_set_byte_timeout(modbus_t *ctx, const struct timeval *timeout);
+MODBUS_API int modbus_get_byte_timeout(modbus_t *ctx, struct timeval *timeout);
+MODBUS_API int modbus_set_byte_timeout(modbus_t *ctx, const struct timeval *timeout);
 
-EXPORT int modbus_get_header_length(modbus_t *ctx);
+MODBUS_API int modbus_get_header_length(modbus_t *ctx);
 
-EXPORT int modbus_connect(modbus_t *ctx);
-EXPORT void modbus_close(modbus_t *ctx);
+MODBUS_API int modbus_connect(modbus_t *ctx);
+MODBUS_API void modbus_close(modbus_t *ctx);
 
-EXPORT void modbus_free(modbus_t *ctx);
+MODBUS_API void modbus_free(modbus_t *ctx);
 
-EXPORT int modbus_flush(modbus_t *ctx);
-EXPORT int modbus_set_debug(modbus_t *ctx, int flag);
+MODBUS_API int modbus_flush(modbus_t *ctx);
+MODBUS_API int modbus_set_debug(modbus_t *ctx, int flag);
 
-EXPORT const char *modbus_strerror(int errnum);
+MODBUS_API const char *modbus_strerror(int errnum);
 
-EXPORT int modbus_read_bits(modbus_t *ctx, int addr, int nb, uint8_t *dest);
-EXPORT int modbus_read_input_bits(modbus_t *ctx, int addr, int nb, uint8_t *dest);
-EXPORT int modbus_read_registers(modbus_t *ctx, int addr, int nb, uint16_t *dest);
-EXPORT int modbus_read_input_registers(modbus_t *ctx, int addr, int nb, uint16_t *dest);
-EXPORT int modbus_write_bit(modbus_t *ctx, int coil_addr, int status);
-EXPORT int modbus_write_register(modbus_t *ctx, int reg_addr, int value);
-EXPORT int modbus_write_bits(modbus_t *ctx, int addr, int nb, const uint8_t *data);
-EXPORT int modbus_write_registers(modbus_t *ctx, int addr, int nb, const uint16_t *data);
-EXPORT int modbus_mask_write_register(modbus_t *ctx, int addr, uint16_t and_mask, uint16_t or_mask);
-EXPORT int modbus_write_and_read_registers(modbus_t *ctx, int write_addr, int write_nb,
+MODBUS_API int modbus_read_bits(modbus_t *ctx, int addr, int nb, uint8_t *dest);
+MODBUS_API int modbus_read_input_bits(modbus_t *ctx, int addr, int nb, uint8_t *dest);
+MODBUS_API int modbus_read_registers(modbus_t *ctx, int addr, int nb, uint16_t *dest);
+MODBUS_API int modbus_read_input_registers(modbus_t *ctx, int addr, int nb, uint16_t *dest);
+MODBUS_API int modbus_write_bit(modbus_t *ctx, int coil_addr, int status);
+MODBUS_API int modbus_write_register(modbus_t *ctx, int reg_addr, int value);
+MODBUS_API int modbus_write_bits(modbus_t *ctx, int addr, int nb, const uint8_t *data);
+MODBUS_API int modbus_write_registers(modbus_t *ctx, int addr, int nb, const uint16_t *data);
+MODBUS_API int modbus_mask_write_register(modbus_t *ctx, int addr, uint16_t and_mask, uint16_t or_mask);
+MODBUS_API int modbus_write_and_read_registers(modbus_t *ctx, int write_addr, int write_nb,
                                            const uint16_t *src, int read_addr, int read_nb,
                                            uint16_t *dest);
-EXPORT int modbus_report_slave_id(modbus_t *ctx, uint8_t *dest);
+MODBUS_API int modbus_report_slave_id(modbus_t *ctx, uint8_t *dest);
 
-EXPORT modbus_mapping_t* modbus_mapping_new(int nb_bits, int nb_input_bits,
+MODBUS_API modbus_mapping_t* modbus_mapping_new(int nb_bits, int nb_input_bits,
                                             int nb_registers, int nb_input_registers);
-EXPORT void modbus_mapping_free(modbus_mapping_t *mb_mapping);
+MODBUS_API void modbus_mapping_free(modbus_mapping_t *mb_mapping);
 
-EXPORT int modbus_send_raw_request(modbus_t *ctx, uint8_t *raw_req, int raw_req_length);
+MODBUS_API int modbus_send_raw_request(modbus_t *ctx, uint8_t *raw_req, int raw_req_length);
 
-EXPORT int modbus_receive(modbus_t *ctx, uint8_t *req);
-EXPORT int modbus_receive_from(modbus_t *ctx, int sockfd, uint8_t *req);
+MODBUS_API int modbus_receive(modbus_t *ctx, uint8_t *req);
+MODBUS_API int modbus_receive_from(modbus_t *ctx, int sockfd, uint8_t *req);
 
-EXPORT int modbus_receive_confirmation(modbus_t *ctx, uint8_t *rsp);
+MODBUS_API int modbus_receive_confirmation(modbus_t *ctx, uint8_t *rsp);
 
-EXPORT int modbus_reply(modbus_t *ctx, const uint8_t *req,
+MODBUS_API int modbus_reply(modbus_t *ctx, const uint8_t *req,
                         int req_length, modbus_mapping_t *mb_mapping);
-EXPORT int modbus_reply_exception(modbus_t *ctx, const uint8_t *req,
+MODBUS_API int modbus_reply_exception(modbus_t *ctx, const uint8_t *req,
                                   unsigned int exception_code);
 
 /**
@@ -221,14 +221,14 @@ EXPORT int modbus_reply_exception(modbus_t *ctx, const uint8_t *req,
         tab_int8[(index) + 1] = (value) & 0xFF; \
     } while (0)
 
-EXPORT void modbus_set_bits_from_byte(uint8_t *dest, int index, const uint8_t value);
-EXPORT void modbus_set_bits_from_bytes(uint8_t *dest, int index, unsigned int nb_bits,
+MODBUS_API void modbus_set_bits_from_byte(uint8_t *dest, int index, const uint8_t value);
+MODBUS_API void modbus_set_bits_from_bytes(uint8_t *dest, int index, unsigned int nb_bits,
                                        const uint8_t *tab_byte);
-EXPORT uint8_t modbus_get_byte_from_bits(const uint8_t *src, int index, unsigned int nb_bits);
-EXPORT float modbus_get_float(const uint16_t *src);
-EXPORT float modbus_get_float_dcba(const uint16_t *src);
-EXPORT void modbus_set_float(float f, uint16_t *dest);
-EXPORT void modbus_set_float_dcba(float f, uint16_t *dest);
+MODBUS_API uint8_t modbus_get_byte_from_bits(const uint8_t *src, int index, unsigned int nb_bits);
+MODBUS_API float modbus_get_float(const uint16_t *src);
+MODBUS_API float modbus_get_float_dcba(const uint16_t *src);
+MODBUS_API void modbus_set_float(float f, uint16_t *dest);
+MODBUS_API void modbus_set_float_dcba(float f, uint16_t *dest);
 
 #include "modbus-tcp.h"
 #include "modbus-rtu.h"