--- a/src/cx/common.h Mon Dec 22 00:20:01 2025 +0100 +++ b/src/cx/common.h Mon Dec 22 00:20:41 2025 +0100 @@ -257,13 +257,22 @@ // --------------------------------------------------------------------------- -// MSVC specifics +// Support for thread_local // --------------------------------------------------------------------------- +#ifdef __cplusplus +#define cx_thread_local thread_local +#else // ! __cplusplus #ifdef _MSC_VER -// fix missing _Thread_local support -#define _Thread_local __declspec(thread) +#define cx_thread_local __declspec(thread) +#else // ! _MSC_VER +#if __STDC_VERSION__ < 202300L +#define cx_thread_local _Thread_local +#else // C23 or newer +#define cx_thread_local thread_local +#endif // C23 #endif // _MSC_VER +#endif // __cplusplus // --------------------------------------------------------------------------- // Exported and inlined functions