From a77d514ec0f868651c052178afd54b121efec1c8 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Sat, 18 Jun 2022 12:50:11 +0200 Subject: [PATCH] [GDNative] Fix GDN_EXPORT define with mingw. The define is **not used by godot**, but in GDNative libraries. I'm not sure it should be defined there in the first place, though we shouldn't change that (for compatibility). 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 to let libraries override it with a build-time define. --- modules/gdnative/include/gdnative/gdnative.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h index a5815f8ed41..664fbe9145a 100644 --- a/modules/gdnative/include/gdnative/gdnative.h +++ b/modules/gdnative/include/gdnative/gdnative.h @@ -53,13 +53,15 @@ extern "C" { #endif // This is for libraries *using* the header, NOT GODOT EXPOSING STUFF!! -#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 #include #include