From 1226243f52e1843be22ad558241440e381815c17 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Fri, 10 Jan 2025 17:04:53 +0100 Subject: [PATCH 1/3] Avoid to include windows.h in realtime_helpers.hpp --- include/realtime_tools/realtime_helpers.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/realtime_tools/realtime_helpers.hpp b/include/realtime_tools/realtime_helpers.hpp index ef486a49..6fea1fa2 100644 --- a/include/realtime_tools/realtime_helpers.hpp +++ b/include/realtime_tools/realtime_helpers.hpp @@ -35,8 +35,11 @@ #include #ifdef _WIN32 -#include -using NATIVE_THREAD_HANDLE = HANDLE; +// Here we directly use void* instead of including windows.h +// and using HANDLE macro to avoid polluting all the downstream +// compilation units that include the public header realtime_helpers.hpp +// with problematic macros like MIN, MAX or ERROR +using NATIVE_THREAD_HANDLE = void*; #else using NATIVE_THREAD_HANDLE = pthread_t; #endif From 84f138c9704ece8cb9cf062174e2c0bbd70754c4 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Fri, 10 Jan 2025 18:04:15 +0100 Subject: [PATCH 2/3] Update realtime_helpers.cpp --- src/realtime_helpers.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/realtime_helpers.cpp b/src/realtime_helpers.cpp index e55894ce..bbabf0bc 100644 --- a/src/realtime_helpers.cpp +++ b/src/realtime_helpers.cpp @@ -28,7 +28,9 @@ #include "realtime_tools/realtime_helpers.hpp" -#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) +#ifdef _WIN32 +#include +#else #include #include #include From 918e7d507bf6d3a4e3b5ee142e1d2c9386a9ab0d Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Fri, 10 Jan 2025 18:13:37 +0100 Subject: [PATCH 3/3] fix clang-format --- include/realtime_tools/realtime_helpers.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/realtime_tools/realtime_helpers.hpp b/include/realtime_tools/realtime_helpers.hpp index 6fea1fa2..3a631976 100644 --- a/include/realtime_tools/realtime_helpers.hpp +++ b/include/realtime_tools/realtime_helpers.hpp @@ -39,7 +39,7 @@ // and using HANDLE macro to avoid polluting all the downstream // compilation units that include the public header realtime_helpers.hpp // with problematic macros like MIN, MAX or ERROR -using NATIVE_THREAD_HANDLE = void*; +using NATIVE_THREAD_HANDLE = void *; #else using NATIVE_THREAD_HANDLE = pthread_t; #endif