Skip to content

Conversation

@akien-mga
Copy link
Member

Follow-up to #113013.

Works for me on Fedora 40 with MinGW 11.0.1.
Does it work for you too on Ubuntu 24.04 @BuzzLord?

@akien-mga akien-mga added this to the 4.6 milestone Jan 15, 2026
@akien-mga akien-mga requested a review from a team as a code owner January 15, 2026 22:48
@akien-mga akien-mga added bug platform:windows topic:buildsystem regression cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release labels Jan 15, 2026
@akien-mga akien-mga force-pushed the windows-mingw-fix-hidsdi-extern-c branch from 638c217 to dac1721 Compare January 15, 2026 22:49
Comment on lines +67 to +74
// 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
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

@BuzzLord
Copy link

Yes it builds for me on Ubuntu 24.04 with this change.

@akien-mga
Copy link
Member Author

Cherry-picked for 4.5.2. (Ahead of the likely merge of this PR, as I want to include it in 4.5.2.rc1.)

@akien-mga akien-mga removed the cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release label Jan 15, 2026
#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.

@akien-mga akien-mga merged commit 9820f40 into godotengine:master Jan 16, 2026
20 checks passed
@akien-mga akien-mga deleted the windows-mingw-fix-hidsdi-extern-c branch January 16, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants