From 5bbcd42378dcd820f9475adf77e40115cdab685d Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Sat, 18 Jun 2022 14:23:28 +0200 Subject: [PATCH] Fix GDN_EXPORT define with mingw. This commit changes the platform detection order to detect mingw compiling for windows (which defines `__GNUC__`). This commit also wraps the definition around a guard so it can be overridden via a define at build-time. --- include/godot_cpp/core/defs.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/godot_cpp/core/defs.hpp b/include/godot_cpp/core/defs.hpp index 7243a610..b9e37162 100644 --- a/include/godot_cpp/core/defs.hpp +++ b/include/godot_cpp/core/defs.hpp @@ -34,13 +34,15 @@ #include #include -#ifdef __GNUC__ -#define GDN_EXPORT __attribute__((visibility("default"))) -#elif defined(_WIN32) +#if !defined(GDN_EXPORT) +#if defined(_WIN32) #define GDN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) +#define GDN_EXPORT __attribute__((visibility("default"))) #else #define GDN_EXPORT #endif +#endif // Turn argument to string constant: // https://gcc.gnu.org/onlinedocs/cpp/Stringizing.html#Stringizing