| 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 | |
| 18 | |
| 19 | #ifndef Foundation_Foundation_INCLUDED |
| 20 | #define Foundation_Foundation_INCLUDED |
| 21 | |
| 22 | |
| 23 | // |
| 24 | // Include library configuration |
| 25 | // |
| 26 | #include "Poco/Config.h" |
| 27 | |
| 28 | |
| 29 | // |
| 30 | // Include platform-specific definitions |
| 31 | // |
| 32 | #include "Poco/Platform.h" |
| 33 | |
| 34 | |
| 35 | // |
| 36 | // Ensure that POCO_DLL is default unless POCO_STATIC is defined |
| 37 | // |
| 38 | #if defined(_WIN32) && defined(_DLL) |
| 39 | #if !defined(POCO_DLL) && !defined(POCO_STATIC) |
| 40 | #define POCO_DLL |
| 41 | #endif |
| 42 | #endif |
| 43 | |
| 44 | |
| 45 | // |
| 46 | // The following block is the standard way of creating macros which make exporting |
| 47 | // from a DLL simpler. All files within this DLL are compiled with the Foundation_EXPORTS |
| 48 | // symbol defined on the command line. this symbol should not be defined on any project |
| 49 | // that uses this DLL. This way any other project whose source files include this file see |
| 50 | // Foundation_API functions as being imported from a DLL, whereas this DLL sees symbols |
| 51 | // defined with this macro as being exported. |
| 52 | // |
| 53 | #if defined(POCO_COMPILER_MSVC) && defined(POCO_DLL) |
| 54 | #if defined(Foundation_EXPORTS) |
| 55 | #define Foundation_API __declspec(dllexport) |
| 56 | #else |
| 57 | #define Foundation_API __declspec(dllimport) |
| 58 | #endif |
| 59 | #endif |
| 60 | |
| 61 | |
| 62 | #if !defined(Foundation_API) |
| 63 | #if !defined(POCO_NO_GCC_API_ATTRIBUTE) && defined (__GNUC__) && (__GNUC__ >= 4) |
| 64 | #define Foundation_API __attribute__ ((visibility ("default"))) |
| 65 | #else |
| 66 | #define Foundation_API |
| 67 | #endif |
| 68 | #endif |
| 69 | |
| 70 | |
| 71 | // |
| 72 | // Automatically link Foundation library. |
| 73 | // |
| 74 | #ifdef POCO_COMPILER_MSVC |
| 75 | #if defined(POCO_DLL) |
| 76 | #if defined(_DEBUG) |
| 77 | #define POCO_LIB_SUFFIX "d.lib" |
| 78 | #else |
| 79 | #define POCO_LIB_SUFFIX ".lib" |
| 80 | #endif |
| 81 | #elif defined(_DLL) |
| 82 | #if defined(_DEBUG) |
| 83 | #define POCO_LIB_SUFFIX "mdd.lib" |
| 84 | #else |
| 85 | #define POCO_LIB_SUFFIX "md.lib" |
| 86 | #endif |
| 87 | #else |
| 88 | #if defined(_DEBUG) |
| 89 | #define POCO_LIB_SUFFIX "mtd.lib" |
| 90 | #else |
| 91 | #define POCO_LIB_SUFFIX "mt.lib" |
| 92 | #endif |
| 93 | #endif |
| 94 | |
| 95 | #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(Foundation_EXPORTS) |
| 96 | #pragma comment(lib, "PocoFoundation" POCO_LIB_SUFFIX) |
| 97 | #endif |
| 98 | #endif |
| 99 | |
| 100 | |
| 101 | #if defined(_WIN32) |
| 102 | #include "Poco/Platform_WIN32.h" |
| 103 | #elif defined(POCO_VXWORKS) |
| 104 | #include "Poco/Platform_VX.h" |
| 105 | #elif defined(POCO_OS_FAMILY_UNIX) |
| 106 | #include "Poco/Platform_POSIX.h" |
| 107 | #endif |
| 108 | |
| 109 | |
| 110 | // |
| 111 | // Include alignment settings early |
| 112 | // |
| 113 | #include "Poco/Alignment.h" |
| 114 | |
| 115 | |
| 116 | // |
| 117 | // POCO_JOIN |
| 118 | // |
| 119 | // The following piece of macro magic joins the two |
| 120 | // arguments together, even when one of the arguments is |
| 121 | // itself a macro (see 16.3.1 in C++ standard). The key |
| 122 | // is that macro expansion of macro arguments does not |
| 123 | // occur in POCO_DO_JOIN2 but does in POCO_DO_JOIN. |
| 124 | // |
| 125 | #define POCO_JOIN(X, Y) POCO_DO_JOIN(X, Y) |
| 126 | #define POCO_DO_JOIN(X, Y) POCO_DO_JOIN2(X, Y) |
| 127 | #define POCO_DO_JOIN2(X, Y) X##Y |
| 128 | |
| 129 | |
| 130 | // |
| 131 | // POCO_DEPRECATED |
| 132 | // |
| 133 | // A macro expanding to a compiler-specific clause to |
| 134 | // mark a class or function as deprecated. |
| 135 | // |
| 136 | #if defined(POCO_NO_DEPRECATED) |
| 137 | #define POCO_DEPRECATED |
| 138 | #elif defined(POCO_COMPILER_GCC) |
| 139 | #define POCO_DEPRECATED __attribute__((deprecated)) |
| 140 | #elif defined(POCO_COMPILER_CLANG) |
| 141 | #define POCO_DEPRECATED __attribute__((deprecated)) |
| 142 | #elif defined(POCO_COMPILER_MSVC) |
| 143 | #define POCO_DEPRECATED __declspec(deprecated) |
| 144 | #else |
| 145 | #define POCO_DEPRECATED |
| 146 | #endif |
| 147 | |
| 148 | |
| 149 | // |
| 150 | // Pull in basic definitions |
| 151 | // |
| 152 | #include "Poco/Bugcheck.h" |
| 153 | #include "Poco/Types.h" |
| 154 | #include <string> |
| 155 | |
| 156 | |
| 157 | #endif // Foundation_Foundation_INCLUDED |
| 158 | |