mingw: Define PGDLLEXPORT as __declspec (dllexport) as done for msvc
authorAndres Freund <[email protected]>
Wed, 28 Sep 2022 17:16:49 +0000 (10:16 -0700)
committerAndres Freund <[email protected]>
Fri, 30 Sep 2022 17:50:05 +0000 (10:50 -0700)
While mingw would otherwise fall back to
__attribute__((visibility("default"))), that appears to only work as long as
no symbols are declared with __declspec(dllexport). But we can end up with
some, e.g. plpython's Py_Init.

It's quite possible we should do the same for cygwin, but I don't have a test
environment for that...

Discussion: http://postgr.es/m/20220928022724[email protected]
Discussion: http://postgr.es/m/20220928025242[email protected]

src/include/port/win32.h

index 67755aadc403bd015c3cb6f22eaa423e3485c88d..d6c13d0bb8f08bb88ca23bf4df87b85242ab0338 100644 (file)
 #endif
 
 /*
- * Under MSVC, functions exported by a loadable module must be marked
- * "dllexport".  Other compilers don't need that.
+ * Functions exported by a loadable module must be marked "dllexport".
+ *
+ * While mingw would otherwise fall back to
+ * __attribute__((visibility("default"))), that appears to only work as long
+ * as no symbols are declared with __declspec(dllexport). But we can end up
+ * with some, e.g. plpython's Py_Init.
  */
-#ifdef _MSC_VER
 #define PGDLLEXPORT __declspec (dllexport)
-#endif