| 1 |
/// @file |
| 2 |
/// @brief macro for API hiding/exposing |
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
/// hide a symbol outside of its containing library |
| 7 |
/// |
| 8 |
/// This should be used for functions that are only called from within the same |
| 9 |
/// containing library. That is, functions that would be `static` if the entire |
| 10 |
/// library was within a single translation unit. The purpose of this annotation |
| 11 |
/// is to reduce symbol conflicts and symbol table bloat in downstream targets |
| 12 |
/// that do not need this symbol exposed. |
| 13 |
#if !defined(__CYGWIN__) && defined(__GNUC__) && !defined(__MINGW32__) |
| 14 |
#define PRIVATE __attribute__((visibility("hidden"))) |
| 15 |
#else |
| 16 |
#define PRIVATE /* Nothing required. In other toolchains, symbol hiding is the \ |
| 17 |
default. */ |
| 18 |
#endif |
| 19 |
|
| 20 |
/// use this macro to hide libutil’s symbols by default |
| 21 |
/// |
| 22 |
/// The expectation is that users of this library (applications, shared |
| 23 |
/// libraries, or static libraries) want to call some of the exposed functions |
| 24 |
/// but not re-export them to their users. This annotation is only correct while |
| 25 |
/// the containing library is built statically. If it were built as a shared |
| 26 |
/// library, API symbols would need to have `default` visibility (and thus be |
| 27 |
/// unavoidably re-exported) in order to be callable. |
| 28 |
#define UTIL_API PRIVATE |