src/ucx/cx/common.h

changeset 490
d218607f5a7e
parent 438
22eca559aded
--- a/src/ucx/cx/common.h	Sat Mar 25 17:18:51 2023 +0100
+++ b/src/ucx/cx/common.h	Fri May 05 18:02:11 2023 +0200
@@ -89,9 +89,13 @@
 /** Version constant which ensures to increase monotonically. */
 #define UCX_VERSION (((UCX_VERSION_MAJOR)<<16)|UCX_VERSION_MINOR)
 
+// Common Includes
+
 #include <stdlib.h>
 #include <stddef.h>
 #include <stdbool.h>
+#include <stdint.h>
+#include <sys/types.h>
 
 /**
  * Function pointer compatible with fwrite-like functions.
@@ -103,19 +107,18 @@
         void *
 );
 
-#ifdef _WIN32
-#ifndef __WORDSIZE
-#ifdef _WIN64
-#define __WORDSIZE 64
-#else
-#define __WORDSIZE 32
-#endif
-#endif // __WORDSIZE
-#else // !_WIN32
+/**
+ * Function pointer compatible with fread-like functions.
+ */
+typedef size_t (*cx_read_func)(
+        void *,
+        size_t,
+        size_t,
+        void *
+);
 
-#include <sys/types.h>
 
-#endif // _WIN32
+// Compiler specific stuff
 
 #ifndef __GNUC__
 /**
@@ -124,4 +127,15 @@
 #define __attribute__(x)
 #endif
 
+#ifdef _MSC_VER
+
+// fix missing ssize_t definition
+#include <BaseTsd.h>
+typedef SSIZE_T ssize_t;
+
+// fix missing _Thread_local support
+#define _Thread_local __declspec(thread)
+
+#endif
+
 #endif // UCX_COMMON_H

mercurial