visibility.h (3212B)
1 /* visibility.h 2 * 3 * Copyright (C) 2006-2025 wolfSSL Inc. 4 * 5 * This file is part of wolfSSL. 6 * 7 * wolfSSL is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * wolfSSL is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA 20 */ 21 22 23 /* Visibility control macros */ 24 25 #ifndef WOLF_CRYPT_VISIBILITY_H 26 #define WOLF_CRYPT_VISIBILITY_H 27 28 /* WOLFSSL_API is used for the public API symbols. 29 It either imports or exports (or does nothing for static builds) 30 31 WOLFSSL_LOCAL is used for non-API symbols (private). 32 */ 33 34 #if defined(BUILDING_WOLFSSL) 35 #if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) || \ 36 defined(_WIN32_WCE) || defined(__WATCOMC__) 37 #if defined(WOLFSSL_DLL) 38 #define WOLFSSL_API __declspec(dllexport) 39 #else 40 #define WOLFSSL_API 41 #endif 42 #define WOLFSSL_LOCAL 43 #elif defined(HAVE_VISIBILITY) && HAVE_VISIBILITY 44 #define WOLFSSL_API __attribute__ ((visibility("default"))) 45 #define WOLFSSL_LOCAL __attribute__ ((visibility("hidden"))) 46 #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) 47 #define WOLFSSL_API __global 48 #define WOLFSSL_LOCAL __hidden 49 #else 50 #define WOLFSSL_API 51 #define WOLFSSL_LOCAL 52 #endif /* HAVE_VISIBILITY */ 53 54 #ifdef WOLFSSL_PRIVATE_TEST_VIS 55 #define WOLFSSL_TEST_VIS WOLFSSL_LOCAL 56 #else 57 #define WOLFSSL_TEST_VIS WOLFSSL_API 58 #endif 59 #else /* !BUILDING_WOLFSSL */ 60 #if defined(__WATCOMC__) 61 #if defined(WOLFSSL_DLL) && defined(__NT__) 62 #define WOLFSSL_API __declspec(dllimport) 63 #else 64 #define WOLFSSL_API 65 #endif 66 #define WOLFSSL_LOCAL 67 #elif defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) || \ 68 defined(_WIN32_WCE) 69 #if defined(WOLFSSL_DLL) 70 #define WOLFSSL_API __declspec(dllimport) 71 #else 72 #define WOLFSSL_API 73 #endif 74 #define WOLFSSL_LOCAL 75 #else 76 #define WOLFSSL_API 77 #define WOLFSSL_LOCAL 78 #endif 79 80 #if defined(WOLFSSL_VIS_FOR_TESTS) 81 #ifdef WOLFSSL_PRIVATE_TEST_VIS 82 #error WOLFSSL_VIS_FOR_TESTS is unavailable in WOLFSSL_PRIVATE_TEST_VIS builds. 83 #endif 84 #define WOLFSSL_TEST_VIS WOLFSSL_API 85 #else 86 #define WOLFSSL_TEST_VIS WOLFSSL_API WC_DEPRECATED("internal use only") 87 #endif 88 89 #endif /* !BUILDING_WOLFSSL */ 90 91 /* WOLFSSL_ABI is used for public API symbols that must not change 92 * their signature. This tag is used for all APIs that are a 93 * part of the fixed ABI. 94 */ 95 #define WOLFSSL_ABI 96 97 #endif /* WOLF_CRYPT_VISIBILITY_H */