소스 검색

[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.
Fabio Alessandrelli 3 년 전
부모
커밋
a77d514ec0
1개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  1. 5 3
      modules/gdnative/include/gdnative/gdnative.h

+ 5 - 3
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 <stdbool.h>
 #include <stdint.h>