| 1 |
/* src/include/port/win32.h */ |
| 2 |
|
| 3 |
/* |
| 4 |
* We always rely on the WIN32 macro being set by our build system, |
| 5 |
* but _WIN32 is the compiler pre-defined macro. So make sure we define |
| 6 |
* WIN32 whenever _WIN32 is set, to facilitate standalone building. |
| 7 |
*/ |
| 8 |
#if defined(_WIN32) && !defined(WIN32) |
| 9 |
#define WIN32 |
| 10 |
#endif |
| 11 |
|
| 12 |
/* |
| 13 |
* Make sure _WIN32_WINNT has the minimum required value. |
| 14 |
* Leave a higher value in place. The minimum requirement is Windows 10. |
| 15 |
*/ |
| 16 |
#ifdef _WIN32_WINNT |
| 17 |
#undef _WIN32_WINNT |
| 18 |
#endif |
| 19 |
|
| 20 |
#define _WIN32_WINNT 0x0A00 |
| 21 |
|
| 22 |
/* |
| 23 |
* We need to prevent <crtdefs.h> from defining a symbol conflicting with |
| 24 |
* our errcode() function. Since it's likely to get included by standard |
| 25 |
* system headers, pre-emptively include it now. |
| 26 |
*/ |
| 27 |
#if defined(_MSC_VER) || defined(HAVE_CRTDEFS_H) |
| 28 |
#define errcode __msvc_errcode |
| 29 |
#include <crtdefs.h> |
| 30 |
#undef errcode |
| 31 |
#endif |
| 32 |
|
| 33 |
/* |
| 34 |
* defines for dynamic linking on Win32 platform |
| 35 |
*/ |
| 36 |
|
| 37 |
/* |
| 38 |
* Variables declared in the core backend and referenced by loadable |
| 39 |
* modules need to be marked "dllimport" in the core build, but |
| 40 |
* "dllexport" when the declaration is read in a loadable module. |
| 41 |
* No special markings should be used when compiling frontend code. |
| 42 |
*/ |
| 43 |
#ifndef FRONTEND |
| 44 |
#ifdef BUILDING_DLL |
| 45 |
#define PGDLLIMPORT __declspec (dllexport) |
| 46 |
#else |
| 47 |
#define PGDLLIMPORT __declspec (dllimport) |
| 48 |
#endif |
| 49 |
#endif |
| 50 |
|
| 51 |
/* |
| 52 |
* Functions exported by a loadable module must be marked "dllexport". |
| 53 |
* |
| 54 |
* While mingw would otherwise fall back to |
| 55 |
* __attribute__((visibility("default"))), that appears to only work as long |
| 56 |
* as no symbols are declared with __declspec(dllexport). But we can end up |
| 57 |
* with some, e.g. plpython's Py_Init. |
| 58 |
*/ |
| 59 |
#define PGDLLEXPORT __declspec (dllexport) |