Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion platform/windows/os_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
#include <avrt.h>
#include <bcrypt.h>
#include <direct.h>
#include <hidsdi.h>
#include <knownfolders.h>
#include <process.h>
#include <psapi.h>
Expand All @@ -65,6 +64,15 @@
#include <wincrypt.h>
#include <winternl.h>

// Workaround missing `extern "C"` in MinGW-w64 < 12.0.0.
#if defined(__MINGW32__) && (!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 12)
Copy link
Member

@bruvzg bruvzg Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nested extern "C"s should not do anything (at least when header has it in #ifdef __cplusplus, which newer MinGW does), so version check can be omitted, but I guess it's better to still have it to make it clear it is MinGW issue.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I mostly added it for documentation purposes, so we don't refactor this to remove the unnecessary check for modern compilers.

extern "C" {
#include <hidsdi.h>
}
#else
#include <hidsdi.h>
#endif
Comment on lines +67 to +74
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, both are a bit messy:

Suggested change
// Workaround missing `extern "C"` in MinGW-w64 < 12.0.0.
#if defined(__MINGW32__) && (!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 12)
extern "C" {
#include <hidsdi.h>
}
#else
#include <hidsdi.h>
#endif
// Workaround missing `extern "C"` in MinGW-w64 < 12.0.0.
#if defined(__MINGW32__) && (!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 12)
extern "C" {
#endif
#include <hidsdi.h>
#if defined(__MINGW32__) && (!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 12)
}
#endif


#if defined(RD_ENABLED)
#include "servers/rendering/rendering_device.h"
#endif
Expand Down