summaryrefslogtreecommitdiffstats
path: root/include/godot_cpp
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-06-18 14:23:28 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-06-18 14:38:18 +0200
commit5bbcd42378dcd820f9475adf77e40115cdab685d (patch)
tree25efb2cc996c3b30147b9808acb8a9965b2f24e7 /include/godot_cpp
parent40f5bfda226b71b629742c8314f2f175da7b523d (diff)
downloadredot-cpp-5bbcd42378dcd820f9475adf77e40115cdab685d.tar.gz
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.
Diffstat (limited to 'include/godot_cpp')
-rw-r--r--include/godot_cpp/core/defs.hpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/godot_cpp/core/defs.hpp b/include/godot_cpp/core/defs.hpp
index 7243a61..b9e3716 100644
--- a/include/godot_cpp/core/defs.hpp
+++ b/include/godot_cpp/core/defs.hpp
@@ -34,13 +34,15 @@
#include <cstddef>
#include <cstdint>
-#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