PostgreSQL Source Code  git master
win32.h
Go to the documentation of this file.
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. When building with at least Visual
15  * Studio 2015 the minimum requirement is Windows Vista (0x0600) to
16  * get support for GetLocaleInfoEx() with locales. For everything else
17  * the minimum version is Windows XP (0x0501).
18  */
19 #if defined(_MSC_VER) && _MSC_VER >= 1900
20 #define MIN_WINNT 0x0600
21 #else
22 #define MIN_WINNT 0x0501
23 #endif
24 
25 #if defined(_WIN32_WINNT) && _WIN32_WINNT < MIN_WINNT
26 #undef _WIN32_WINNT
27 #endif
28 
29 #ifndef _WIN32_WINNT
30 #define _WIN32_WINNT MIN_WINNT
31 #endif
32 
33 /*
34  * We need to prevent <crtdefs.h> from defining a symbol conflicting with
35  * our errcode() function. Since it's likely to get included by standard
36  * system headers, pre-emptively include it now.
37  */
38 #if _MSC_VER >= 1400 || defined(HAVE_CRTDEFS_H)
39 #define errcode __msvc_errcode
40 #include <crtdefs.h>
41 #undef errcode
42 #endif
43 
44 /*
45  * defines for dynamic linking on Win32 platform
46  * http://support.microsoft.com/kb/132044
47  * http://msdn.microsoft.com/en-us/library/8fskxacy(v=vs.80).aspx
48  * http://msdn.microsoft.com/en-us/library/a90k134d(v=vs.80).aspx
49  */
50 
51 #ifdef BUILDING_DLL
52 #define PGDLLIMPORT __declspec (dllexport)
53 #else
54 #define PGDLLIMPORT __declspec (dllimport)
55 #endif
56 
57 #ifdef _MSC_VER
58 #define PGDLLEXPORT __declspec (dllexport)
59 #else
60 #define PGDLLEXPORT
61 #endif