TIMCloudComm.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. // Copyright (c) 2021 Tencent. All rights reserved.
  2. #ifndef SRC_PLATFORM_CROSS_PLATFORM_INCLUDE_TIM_CLOUD_COMM_H_
  3. #define SRC_PLATFORM_CROSS_PLATFORM_INCLUDE_TIM_CLOUD_COMM_H_
  4. #include <sys/types.h>
  5. #ifndef _MSC_VER
  6. // stdint.h is part of C99 but MSVC doesn't have it.
  7. #include <stdint.h> // For intptr_t.
  8. #endif
  9. /* define int types*/
  10. #if defined(__GNUC__)
  11. #ifndef _STDINT_H
  12. #if defined(__PROSPERO__) || defined(__ORBIS__)
  13. typedef u_int8_t uint8_t;
  14. typedef u_int16_t uint16_t;
  15. typedef u_int32_t uint32_t;
  16. typedef u_int64_t uint64_t;
  17. #elif !defined(_SYS_TYPES_H)
  18. typedef signed char int8_t;
  19. typedef signed short int16_t;
  20. typedef signed int int32_t;
  21. typedef signed long long int64_t;
  22. typedef unsigned char uint8_t;
  23. typedef unsigned short uint16_t;
  24. typedef unsigned int uint32_t;
  25. typedef unsigned long long uint64_t;
  26. #else
  27. /* FreeBSD has these C99 int types defined in /sys/inttypes.h already */
  28. typedef u_int8_t uint8_t;
  29. typedef u_int16_t uint16_t;
  30. typedef u_int32_t uint32_t;
  31. typedef u_int64_t uint64_t;
  32. #endif // defined(__PROSPERO__) || defined(__ORBIS__)
  33. #endif // _STDINT_H
  34. #elif defined(_MSC_VER)
  35. typedef signed char int8_t;
  36. typedef signed short int16_t;
  37. typedef signed int int32_t;
  38. typedef signed __int64 int64_t;
  39. typedef unsigned char uint8_t;
  40. typedef unsigned short uint16_t;
  41. typedef unsigned int uint32_t;
  42. typedef unsigned __int64 uint64_t;
  43. /* the following definitions are from VS2010's stdint.h */
  44. #ifndef _INTPTR_T_DEFINED
  45. #define _INTPTR_T_DEFINED
  46. #ifdef _WIN64
  47. typedef __int64 intptr_t;
  48. #else /* _WIN64 */
  49. typedef int intptr_t;
  50. #endif /* _WIN64 */
  51. #endif /* _INTPTR_T_DEFINED */
  52. #ifndef _UINTPTR_T_DEFINED
  53. #define _UINTPTR_T_DEFINED
  54. #ifdef _WIN64
  55. typedef unsigned __int64 uintptr_t;
  56. #else /* _WIN64 */
  57. typedef unsigned int uintptr_t;
  58. #endif /* _WIN64 */
  59. #endif /* _UINTPTR_T_DEFINED */
  60. #endif // COMPILER_GCC/COMPILER_MSVC
  61. #ifndef __cplusplus
  62. /* Even in pure C, we still need a standard boolean typedef */
  63. #ifndef bool
  64. typedef unsigned char bool;
  65. #endif
  66. #ifndef true
  67. #define true (1)
  68. #endif
  69. #ifndef false
  70. #define false (0)
  71. #endif
  72. #endif /* !__cplusplus */
  73. #if defined(_WIN32) || defined(__PROSPERO__) || defined(__ORBIS__)
  74. #if defined(ENABLE_STATIC_LIB)
  75. #define TIM_API
  76. #else
  77. #if defined(TIM_EXPORTS)
  78. #define TIM_API __declspec(dllexport)
  79. #else
  80. #define TIM_API __declspec(dllimport)
  81. #endif
  82. #endif
  83. #else
  84. #define TIM_API __attribute__ ((visibility ("default")))
  85. #endif
  86. #define TIM_DECL TIM_API
  87. #endif // SRC_PLATFORM_CROSS_PLATFORM_INCLUDE_TIM_CLOUD_COMM_H_