src/ucx/cx/common.h

changeset 490
d218607f5a7e
parent 438
22eca559aded
equal deleted inserted replaced
489:921f83a8943f 490:d218607f5a7e
87 #define UCX_VERSION_MINOR 0 87 #define UCX_VERSION_MINOR 0
88 88
89 /** Version constant which ensures to increase monotonically. */ 89 /** Version constant which ensures to increase monotonically. */
90 #define UCX_VERSION (((UCX_VERSION_MAJOR)<<16)|UCX_VERSION_MINOR) 90 #define UCX_VERSION (((UCX_VERSION_MAJOR)<<16)|UCX_VERSION_MINOR)
91 91
92 // Common Includes
93
92 #include <stdlib.h> 94 #include <stdlib.h>
93 #include <stddef.h> 95 #include <stddef.h>
94 #include <stdbool.h> 96 #include <stdbool.h>
97 #include <stdint.h>
98 #include <sys/types.h>
95 99
96 /** 100 /**
97 * Function pointer compatible with fwrite-like functions. 101 * Function pointer compatible with fwrite-like functions.
98 */ 102 */
99 typedef size_t (*cx_write_func)( 103 typedef size_t (*cx_write_func)(
101 size_t, 105 size_t,
102 size_t, 106 size_t,
103 void * 107 void *
104 ); 108 );
105 109
106 #ifdef _WIN32 110 /**
107 #ifndef __WORDSIZE 111 * Function pointer compatible with fread-like functions.
108 #ifdef _WIN64 112 */
109 #define __WORDSIZE 64 113 typedef size_t (*cx_read_func)(
110 #else 114 void *,
111 #define __WORDSIZE 32 115 size_t,
112 #endif 116 size_t,
113 #endif // __WORDSIZE 117 void *
114 #else // !_WIN32 118 );
115 119
116 #include <sys/types.h>
117 120
118 #endif // _WIN32 121 // Compiler specific stuff
119 122
120 #ifndef __GNUC__ 123 #ifndef __GNUC__
121 /** 124 /**
122 * Removes GNU C attributes where they are not supported. 125 * Removes GNU C attributes where they are not supported.
123 */ 126 */
124 #define __attribute__(x) 127 #define __attribute__(x)
125 #endif 128 #endif
126 129
130 #ifdef _MSC_VER
131
132 // fix missing ssize_t definition
133 #include <BaseTsd.h>
134 typedef SSIZE_T ssize_t;
135
136 // fix missing _Thread_local support
137 #define _Thread_local __declspec(thread)
138
139 #endif
140
127 #endif // UCX_COMMON_H 141 #endif // UCX_COMMON_H

mercurial