2
0

win32.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* src/include/port/win32.h */
  2. /*
  3. * We always rely on the WIN32 macro being set by our build system,
  4. * but _WIN32 is the compiler pre-defined macro. So make sure we define
  5. * WIN32 whenever _WIN32 is set, to facilitate standalone building.
  6. */
  7. #if defined(_WIN32) && !defined(WIN32)
  8. #define WIN32
  9. #endif
  10. /*
  11. * Make sure _WIN32_WINNT has the minimum required value.
  12. * Leave a higher value in place. When building with at least Visual
  13. * Studio 2015 the minimum requirement is Windows Vista (0x0600) to
  14. * get support for GetLocaleInfoEx() with locales. For everything else
  15. * the minimum version is Windows XP (0x0501).
  16. */
  17. #if defined(_MSC_VER) && _MSC_VER >= 1900
  18. #define MIN_WINNT 0x0600
  19. #else
  20. #define MIN_WINNT 0x0501
  21. #endif
  22. #if defined(_WIN32_WINNT) && _WIN32_WINNT < MIN_WINNT
  23. #undef _WIN32_WINNT
  24. #endif
  25. #ifndef _WIN32_WINNT
  26. #define _WIN32_WINNT MIN_WINNT
  27. #endif
  28. /*
  29. * We need to prevent <crtdefs.h> from defining a symbol conflicting with
  30. * our errcode() function. Since it's likely to get included by standard
  31. * system headers, pre-emptively include it now.
  32. */
  33. #if defined(_MSC_VER) || defined(HAVE_CRTDEFS_H)
  34. #define errcode __msvc_errcode
  35. #include <crtdefs.h>
  36. #undef errcode
  37. #endif
  38. /*
  39. * defines for dynamic linking on Win32 platform
  40. */
  41. /*
  42. * Variables declared in the core backend and referenced by loadable
  43. * modules need to be marked "dllimport" in the core build, but
  44. * "dllexport" when the declaration is read in a loadable module.
  45. * No special markings should be used when compiling frontend code.
  46. */
  47. #ifndef FRONTEND
  48. #ifdef BUILDING_DLL
  49. #define PGDLLIMPORT __declspec (dllexport)
  50. #else
  51. #define PGDLLIMPORT __declspec (dllimport)
  52. #endif
  53. #endif
  54. /*
  55. * Under MSVC, functions exported by a loadable module must be marked
  56. * "dllexport". Other compilers don't need that.
  57. */
  58. #ifdef _MSC_VER
  59. #define PGDLLEXPORT __declspec (dllexport)
  60. #endif
  61. /*
  62. * Windows headers don't define this structure, but you can define it yourself
  63. * to use the functionality.
  64. */
  65. struct sockaddr_un
  66. {
  67. unsigned short sun_family;
  68. char sun_path[108];
  69. };
  70. #define HAVE_STRUCT_SOCKADDR_UN 1