src/cx/common.h

changeset 1426
3a89b31f0724
parent 1424
563033aa998c
equal deleted inserted replaced
1425:83284b289430 1426:3a89b31f0724
263 #ifdef _MSC_VER 263 #ifdef _MSC_VER
264 // fix missing _Thread_local support 264 // fix missing _Thread_local support
265 #define _Thread_local __declspec(thread) 265 #define _Thread_local __declspec(thread)
266 #endif // _MSC_VER 266 #endif // _MSC_VER
267 267
268 // ---------------------------------------------------------------------------
269 // Exported and inlined functions
270 // ---------------------------------------------------------------------------
271
268 #if defined(CX_WINDLL_EXPORT) 272 #if defined(CX_WINDLL_EXPORT)
269 #define cx_attr_export __declspec(dllexport) 273 #define CX_EXPORT __declspec(dllexport)
270 #elif defined(CX_WINDLL) 274 #elif defined(CX_WINDLL)
271 #define cx_attr_export __declspec(dllimport) 275 #define CX_EXPORT __declspec(dllimport)
272 #else 276 #else
273 /** Only used for building Windows DLLs. */ 277 /** Only used for building Windows DLLs. */
274 #define cx_attr_export 278 #define CX_EXPORT
275 #endif // CX_WINDLL / CX_WINDLL_EXPORT 279 #endif // CX_WINDLL / CX_WINDLL_EXPORT
276 280
281 #ifdef __GNUC__
282 /**
283 * Declares a function to be inlined.
284 */
285 #define CX_INLINE __attribute__((always_inline)) static inline
286 #else
287 #define CX_INLINE static inline
288 #endif
289 /**
290 * Declares a compatibility function for C++ builds.
291 */
292 #define CX_CPPDECL static inline
293
277 // --------------------------------------------------------------------------- 294 // ---------------------------------------------------------------------------
278 // Useful function pointers 295 // Useful function pointers
279 // --------------------------------------------------------------------------- 296 // ---------------------------------------------------------------------------
280 297
281 /** 298 /**
282 * Function pointer compatible with fwrite-like functions. 299 * Function pointer compatible with fwrite-like functions.
283 */ 300 */
284 typedef size_t (*cx_write_func)( 301 typedef size_t (*cx_write_func)(const void*, size_t, size_t, void*);
285 const void *,
286 size_t,
287 size_t,
288 void *
289 );
290 302
291 /** 303 /**
292 * Function pointer compatible with fread-like functions. 304 * Function pointer compatible with fread-like functions.
293 */ 305 */
294 typedef size_t (*cx_read_func)( 306 typedef size_t (*cx_read_func)(void*, size_t, size_t, void*);
295 void *,
296 size_t,
297 size_t,
298 void *
299 );
300 307
301 // --------------------------------------------------------------------------- 308 // ---------------------------------------------------------------------------
302 // Utility macros 309 // Utility macros
303 // --------------------------------------------------------------------------- 310 // ---------------------------------------------------------------------------
304 311
349 extern "C" 356 extern "C"
350 #endif 357 #endif
351 cx_attr_export int cx_szmul_impl(size_t a, size_t b, size_t *result); 358 cx_attr_export int cx_szmul_impl(size_t a, size_t b, size_t *result);
352 #endif // cx_szmul 359 #endif // cx_szmul
353 360
354
355
356 #endif // UCX_COMMON_H 361 #endif // UCX_COMMON_H

mercurial