Aria
3.2.6
C++23 MVVM framework — reactive, coroutine-first, ABI-layered
Toggle main menu visibility
Loading...
Searching...
No Matches
export.hpp
Go to the documentation of this file.
1
#pragma once
2
3
// Cross-platform symbol visibility macros.
4
// Each shared library defines ARIA_<MODULE>_BUILD when compiling its own sources.
5
6
#if defined(_WIN32) || defined(__CYGWIN__)
7
# define ARIA_EXPORT __declspec(dllexport)
8
# define ARIA_IMPORT __declspec(dllimport)
9
#else
10
# define ARIA_EXPORT __attribute__((visibility("default")))
11
# define ARIA_IMPORT __attribute__((visibility("default")))
12
#endif
13
14
// A static Aria build has no DLL boundary, so every module macro must be empty
15
// together. If one class is imported while its base is local, MSVC reports
16
// C4275 (a dll-interface class deriving from a non-dll class) and /WX makes it
17
// an error — which is what a static build that only partly sees ARIA_*_STATIC
18
// produced.
19
#ifdef ARIA_STATIC_LINKAGE
20
# define ARIA_ABI_API
21
# define ARIA_RUNTIME_API
22
# define ARIA_CORE_API
23
# define ARIA_BINDING_API
24
# define ARIA_QT6_API
25
# define ARIA_HTTP_API
26
# define ARIA_JNI_API
27
# define ARIA_MODULE_MACROS_DEFINED 1
28
#endif
29
30
#ifndef ARIA_MODULE_MACROS_DEFINED
31
// ABI module
32
#if defined(ARIA_ABI_BUILD)
33
# define ARIA_ABI_API ARIA_EXPORT
34
#elif defined(ARIA_ABI_STATIC)
35
// Static consumers do not import symbols from a DLL.
36
# define ARIA_ABI_API
37
#else
38
# define ARIA_ABI_API ARIA_IMPORT
39
#endif
40
41
// Runtime module
42
#if defined(ARIA_RUNTIME_BUILD)
43
# define ARIA_RUNTIME_API ARIA_EXPORT
44
#elif defined(ARIA_RUNTIME_STATIC)
45
# define ARIA_RUNTIME_API
46
#else
47
# define ARIA_RUNTIME_API ARIA_IMPORT
48
#endif
49
50
// Binding module
51
#if defined(ARIA_BINDING_BUILD)
52
# define ARIA_BINDING_API ARIA_EXPORT
53
#elif defined(ARIA_BINDING_STATIC)
54
# define ARIA_BINDING_API
55
#else
56
# define ARIA_BINDING_API ARIA_IMPORT
57
#endif
58
59
// Core module (diagnostics/trace sink storage lives in runtime DLL)
60
#if defined(ARIA_RUNTIME_BUILD)
61
# define ARIA_CORE_API ARIA_EXPORT
62
#elif defined(ARIA_RUNTIME_STATIC)
63
# define ARIA_CORE_API
64
#else
65
# define ARIA_CORE_API ARIA_IMPORT
66
#endif
67
68
// Qt6 adapter module
69
#if defined(ARIA_QT6_BUILD)
70
# define ARIA_QT6_API ARIA_EXPORT
71
#elif defined(ARIA_QT6_STATIC)
72
# define ARIA_QT6_API
73
#else
74
# define ARIA_QT6_API ARIA_IMPORT
75
#endif
76
77
// HTTP adapter module
78
#if defined(ARIA_HTTP_BUILD)
79
# define ARIA_HTTP_API ARIA_EXPORT
80
#elif defined(ARIA_HTTP_STATIC)
81
# define ARIA_HTTP_API
82
#else
83
# define ARIA_HTTP_API ARIA_IMPORT
84
#endif
85
86
// JNI (Android) adapter module
87
#if defined(ARIA_JNI_BUILD)
88
# define ARIA_JNI_API ARIA_EXPORT
89
#elif defined(ARIA_JNI_STATIC)
90
# define ARIA_JNI_API
91
#else
92
# define ARIA_JNI_API ARIA_IMPORT
93
#endif
94
95
#endif
// ARIA_MODULE_MACROS_DEFINED
96
97
// Force-inline
98
#if defined(_MSC_VER)
99
# define ARIA_ALWAYS_INLINE __forceinline
100
#else
101
# define ARIA_ALWAYS_INLINE __attribute__((always_inline)) inline
102
#endif
103
104
// Branch-prediction hints.
105
//
106
// `__builtin_expect` is a GCC/Clang extension that MSVC does not provide.
107
// We therefore use it only on compilers that support it, and degrade to a
108
// plain expression elsewhere. The C++20 [[likely]] / [[unlikely]] attributes
109
// cannot be used here because these macros are expanded inside ordinary
110
// expressions (e.g. `if (ARIA_LIKELY(ptr)) ...`), not on statements.
111
#if defined(__GNUC__) || defined(__clang__)
112
# define ARIA_LIKELY(x) (__builtin_expect(!!(x), 1))
113
# define ARIA_UNLIKELY(x) (__builtin_expect(!!(x), 0))
114
#else
115
# define ARIA_LIKELY(x) (!!(x))
116
# define ARIA_UNLIKELY(x) (!!(x))
117
#endif
modules
abi
include
aria
abi
export.hpp
Generated by
1.18.0