MySQL Connector/C++
9.4.0
MySQL connector library for C and C++ applications
include
mysqlx
common
api.h
1
/*
2
* Copyright (c) 2015, 2024, Oracle and/or its affiliates.
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License, version 2.0, as
6
* published by the Free Software Foundation.
7
*
8
* This program is designed to work with certain software (including
9
* but not limited to OpenSSL) that is licensed under separate terms, as
10
* designated in a particular file or component or in included license
11
* documentation. The authors of MySQL hereby grant you an additional
12
* permission to link the program and your derivative works with the
13
* separately licensed software that they have either included with
14
* the program or referenced in the documentation.
15
*
16
* Without limiting anything contained in the foregoing, this file,
17
* which is part of Connector/C++, is also subject to the
18
* Universal FOSS Exception, version 1.0, a copy of which can be found at
19
* https://oss.oracle.com/licenses/universal-foss-exception.
20
*
21
* This program is distributed in the hope that it will be useful, but
22
* WITHOUT ANY WARRANTY; without even the implied warranty of
23
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
24
* See the GNU General Public License, version 2.0, for more details.
25
*
26
* You should have received a copy of the GNU General Public License
27
* along with this program; if not, write to the Free Software Foundation, Inc.,
28
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29
*/
30
31
#ifndef MYSQLX_COMMON_API_H
32
#define MYSQLX_COMMON_API_H
33
34
35
/*
36
X DevAPI ABI version and revision
37
=================================
38
39
All public symbols inside mysqlx namespace should be defined inside
40
MYSQLX_ABI_BEGIN(X,Y) ... MYSQLX_ABI_END(X,Y) block, where X.Y is the
41
ABI version of the symbol. This puts the symbol inside mysqlx::abiX::rY
42
namespace.
43
44
The current ABI version is determined by MYSQLX_ABI_X_Y macros below. Using
45
inline namespace ensures that symbol reference mysqlx::foo resolves
46
to mysqlx::abiX::rY::foo, where X.Y is the current ABI version.
47
48
Declarations below ensure, that each ABI revision namespace includes all
49
symbols from previous revisions (via using namespace declaration).
50
51
If the same symbol is defined for several revisions of the ABI, the latest
52
one will shadow other definitions but earlier revisions will be also present
53
to be used by old code. This way backward ABI compatibility can be maintained.
54
*/
55
56
/*
57
When new ABI version or revision is added, the corresponding
58
MYSQLX_ABI_MAJOR/MINOR_X macro needs to be added below. The macros for the
59
latest ABI version and revision should expand to "inline", other MSQLX_ABI_*
60
macros should have empty expansion. For example,
61
after adding revision ABI 2.1 these macros should look as follows:
62
63
#define MYSQLX_ABI_MAJOR_2 inline // current ABI version
64
#define MYSQLX_ABI_MINOR_0
65
#define MYSQLX_ABI_MINOR_1 inline // current ABI revision
66
67
TODO: Auto-generate this based on information in version.cmake
68
*/
69
70
#define MYSQLX_ABI_MAJOR_2 inline
// current ABI version
71
#define MYSQLX_ABI_MINOR_0 inline
// current ABI revision
72
73
74
#define MYSQLX_ABI_BEGIN(X,Y) \
75
MYSQLX_ABI_MAJOR_ ## X namespace abi ## X { \
76
MYSQLX_ABI_MINOR_ ## Y namespace r ## Y {
77
78
#define MYSQLX_ABI_END(X,Y) }}
79
80
#define MYSQLX_ABI(X,Y) mysqlx::abi##X::r##Y
81
82
#ifdef __cplusplus
83
84
namespace
mysqlx {
85
86
87
MYSQLX_ABI_BEGIN(2,0)
88
89
namespace internal {
90
}
91
92
namespace
common {
93
}
94
95
MYSQLX_ABI_END(2,0)
96
97
/*
98
When new revision 1 of the current ABI 2 is added, the following declarations
99
should be added. They import all revision 0 symbols into revision 1. Symbols
100
that have changed should be defined inside
101
MYSQLX_ABI_BEGIN(2,1) ... MYSQLX_ABI_END(2,1) and they will
102
shadow the corresponding revision 0 symbol.
103
104
MYSQLX_ABI_BEGIN(2,1)
105
106
using namespace r0;
107
108
namespace internal {
109
using namespace r0::internal;
110
}
111
112
namespace common {
113
using namespace r0::common;
114
}
115
116
MYSQLX_ABI_END(2,1)
117
*/
118
119
}
120
121
#endif
// __cplusplus
122
123
124
/*
125
Macros for declaring public API
126
===============================
127
128
API function declarations should be decorated with PUBLIC_API prefix. API
129
classes should have PUBLIC_API marker between the "class" keyword and
130
the class name.
131
132
See: https://gcc.gnu.org/wiki/Visibility
133
134
TODO: Use better name than PUBLIC_API - not all public API classes should
135
be decorated with these declarations but only these whose implementation
136
is inside the library (so, not the ones which are implemented in headers).
137
*/
138
139
#if defined _MSC_VER
140
141
#define DLL_EXPORT __declspec(dllexport)
142
#define DLL_IMPORT __declspec(dllimport)
143
#define DLL_LOCAL
144
145
#elif __GNUC__ >= 4
146
147
#define DLL_EXPORT __attribute__ ((visibility ("default"
)))
148
#define DLL_IMPORT
149
#define DLL_LOCAL __attribute__ ((visibility ("hidden"
)))
150
151
#elif defined __SUNPRO_CC || defined __SUNPRO_C
152
153
#define DLL_EXPORT __global
154
#define DLL_IMPORT __global
155
#define DLL_LOCAL __hidden
156
157
#else
158
159
#define DLL_EXPORT
160
#define DLL_IMPORT
161
#define DLL_LOCAL
162
163
#endif
164
165
166
#if defined CONCPP_BUILD_SHARED
167
#define PUBLIC_API DLL_EXPORT
168
#define MYSQLX_INTERNAL DLL_LOCAL
169
#elif defined CONCPP_BUILD_STATIC
170
#define PUBLIC_API
171
#define MYSQLX_INTERNAL
172
#elif !defined STATIC_CONCPP
173
#define PUBLIC_API DLL_IMPORT
174
#define MYSQLX_INTERNAL
175
#else
176
#define PUBLIC_API
177
#define MYSQLX_INTERNAL
178
#endif
179
180
181
#endif
Copyright (c) 2015, 2020, Oracle and/or its affiliates. Generated on Mon Jul 7 2025 15:44:44 for MySQL Connector/C++ by
doxygen
1.9.2