work around some MSC problems

Sun, 16 Apr 2023 21:09:25 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 16 Apr 2023 21:09:25 +0200
changeset 682
34120a385fc8
parent 681
502105523db7
child 683
aa0d09f2d81c

work around some MSC problems

src/cx/common.h file | annotate | diff | comparison | revisions
     1.1 --- a/src/cx/common.h	Sun Apr 16 20:50:19 2023 +0200
     1.2 +++ b/src/cx/common.h	Sun Apr 16 21:09:25 2023 +0200
     1.3 @@ -89,10 +89,13 @@
     1.4  /** Version constant which ensures to increase monotonically. */
     1.5  #define UCX_VERSION (((UCX_VERSION_MAJOR)<<16)|UCX_VERSION_MINOR)
     1.6  
     1.7 +// Common Includes
     1.8 +
     1.9  #include <stdlib.h>
    1.10  #include <stddef.h>
    1.11  #include <stdbool.h>
    1.12  #include <stdint.h>
    1.13 +#include <sys/types.h>
    1.14  
    1.15  /**
    1.16   * Function pointer compatible with fwrite-like functions.
    1.17 @@ -114,17 +117,8 @@
    1.18          void *
    1.19  );
    1.20  
    1.21 -#ifdef _WIN32
    1.22  
    1.23 -#ifdef __MINGW32__
    1.24 -#include <sys/types.h>
    1.25 -#endif // __MINGW32__
    1.26 -
    1.27 -#else // !_WIN32
    1.28 -
    1.29 -#include <sys/types.h>
    1.30 -
    1.31 -#endif // _WIN32
    1.32 +// Compiler specific stuff
    1.33  
    1.34  #ifndef __GNUC__
    1.35  /**
    1.36 @@ -133,4 +127,15 @@
    1.37  #define __attribute__(x)
    1.38  #endif
    1.39  
    1.40 +#ifdef _MSC_VER
    1.41 +
    1.42 +// fix missing ssize_t definition
    1.43 +#include <BaseTsd.h>
    1.44 +typedef SSIZE_T ssize_t;
    1.45 +
    1.46 +// fix missing _Thread_local support
    1.47 +#define _Thread_local __declspec(thread)
    1.48 +
    1.49 +#endif
    1.50 +
    1.51  #endif // UCX_COMMON_H

mercurial