Foundation.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. //
  2. // Foundation.h
  3. //
  4. // Library: Foundation
  5. // Package: Core
  6. // Module: Foundation
  7. //
  8. // Basic definitions for the POCO Foundation library.
  9. // This file must be the first file included by every other Foundation
  10. // header file.
  11. //
  12. // Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH.
  13. // and Contributors.
  14. //
  15. // SPDX-License-Identifier: BSL-1.0
  16. //
  17. #ifndef Foundation_Foundation_INCLUDED
  18. #define Foundation_Foundation_INCLUDED
  19. //
  20. // Include library configuration
  21. //
  22. #include "Poco/Config.h"
  23. //
  24. // Ensure that POCO_DLL is default unless POCO_STATIC is defined
  25. //
  26. #if defined(_WIN32) && defined(_DLL)
  27. #if !defined(POCO_DLL) && !defined(POCO_STATIC)
  28. #define POCO_DLL
  29. #endif
  30. #endif
  31. //
  32. // The following block is the standard way of creating macros which make exporting
  33. // from a DLL simpler. All files within this DLL are compiled with the Foundation_EXPORTS
  34. // symbol defined on the command line. this symbol should not be defined on any project
  35. // that uses this DLL. This way any other project whose source files include this file see
  36. // Foundation_API functions as being imported from a DLL, wheras this DLL sees symbols
  37. // defined with this macro as being exported.
  38. //
  39. #if (defined(_WIN32) || defined(_WIN32_WCE)) && defined(POCO_DLL)
  40. #if defined(Foundation_EXPORTS)
  41. #define Foundation_API __declspec(dllexport)
  42. #else
  43. #define Foundation_API __declspec(dllimport)
  44. #endif
  45. #endif
  46. #if !defined(Foundation_API)
  47. #if !defined(POCO_NO_GCC_API_ATTRIBUTE) && defined (__GNUC__) && (__GNUC__ >= 4)
  48. #define Foundation_API __attribute__ ((visibility ("default")))
  49. #else
  50. #define Foundation_API
  51. #endif
  52. #endif
  53. //
  54. // Automatically link Foundation library.
  55. //
  56. #if defined(_MSC_VER)
  57. #if defined(POCO_DLL)
  58. #if defined(_DEBUG)
  59. #define POCO_LIB_SUFFIX "d.lib"
  60. #else
  61. #define POCO_LIB_SUFFIX ".lib"
  62. #endif
  63. #elif defined(_DLL)
  64. #if defined(_DEBUG)
  65. #define POCO_LIB_SUFFIX "mdd.lib"
  66. #else
  67. #define POCO_LIB_SUFFIX "md.lib"
  68. #endif
  69. #else
  70. #if defined(_DEBUG)
  71. #define POCO_LIB_SUFFIX "mtd.lib"
  72. #else
  73. #define POCO_LIB_SUFFIX "mt.lib"
  74. #endif
  75. #endif
  76. #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(Foundation_EXPORTS)
  77. #pragma comment(lib, "PocoFoundation" POCO_LIB_SUFFIX)
  78. #endif
  79. #endif
  80. //
  81. // Include platform-specific definitions
  82. //
  83. #include "Poco/Platform.h"
  84. #if defined(_WIN32)
  85. #include "Poco/Platform_WIN32.h"
  86. #elif defined(POCO_VXWORKS)
  87. #include "Poco/Platform_VX.h"
  88. #elif defined(POCO_OS_FAMILY_UNIX)
  89. #include "Poco/Platform_POSIX.h"
  90. #endif
  91. //
  92. // Include alignment settings early
  93. //
  94. #include "Poco/Alignment.h"
  95. //
  96. // Cleanup inconsistencies
  97. //
  98. #ifdef POCO_OS_FAMILY_WINDOWS
  99. #if defined(POCO_WIN32_UTF8) && defined(POCO_NO_WSTRING)
  100. #error POCO_WIN32_UTF8 and POCO_NO_WSTRING are mutually exclusive.
  101. #endif
  102. #else
  103. #ifdef POCO_WIN32_UTF8
  104. #undef POCO_WIN32_UTF8
  105. #endif
  106. #endif
  107. //
  108. // POCO_JOIN
  109. //
  110. // The following piece of macro magic joins the two
  111. // arguments together, even when one of the arguments is
  112. // itself a macro (see 16.3.1 in C++ standard). The key
  113. // is that macro expansion of macro arguments does not
  114. // occur in POCO_DO_JOIN2 but does in POCO_DO_JOIN.
  115. //
  116. #define POCO_JOIN(X, Y) POCO_DO_JOIN(X, Y)
  117. #define POCO_DO_JOIN(X, Y) POCO_DO_JOIN2(X, Y)
  118. #define POCO_DO_JOIN2(X, Y) X##Y
  119. //
  120. // POCO_DEPRECATED
  121. //
  122. // A macro expanding to a compiler-specific clause to
  123. // mark a class or function as deprecated.
  124. //
  125. #if defined(POCO_NO_DEPRECATED)
  126. #define POCO_DEPRECATED
  127. #elif defined(_GNUC_)
  128. #define POCO_DEPRECATED __attribute__((deprecated))
  129. #elif defined(__clang__)
  130. #define POCO_DEPRECATED __attribute__((deprecated))
  131. #elif defined(_MSC_VER)
  132. #define POCO_DEPRECATED __declspec(deprecated)
  133. #else
  134. #define POCO_DEPRECATED
  135. #endif
  136. //
  137. // Pull in basic definitions
  138. //
  139. #include "Poco/Bugcheck.h"
  140. #include "Poco/Types.h"
  141. #include <string>
  142. #endif // Foundation_Foundation_INCLUDED