Skip to content

Commit f1e60cc

Browse files
committed
Include __cdecl in std::function<T> for exported symbols
1 parent 1cf9334 commit f1e60cc

File tree

2 files changed

+106
-61
lines changed
  • src/mongocxx
    • include/mongocxx/v_noabi/mongocxx/options
    • lib/mongocxx/v_noabi/mongocxx/options

2 files changed

+106
-61
lines changed

src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/apm.hpp

Lines changed: 63 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,16 @@ class apm {
5757
/// method chaining.
5858
///
5959
MONGOCXX_ABI_EXPORT_CDECL(apm&)
60-
on_command_started(std::function<void(const events::command_started_event&)> command_started);
60+
on_command_started(std::function<void MONGOCXX_ABI_CDECL(const events::command_started_event&)>
61+
command_started);
6162

6263
///
6364
/// Retrieves the command started monitoring callback.
6465
///
6566
/// @return The command started monitoring callback.
6667
///
67-
MONGOCXX_ABI_EXPORT_CDECL(const std::function<void(const events::command_started_event&)>&)
68+
MONGOCXX_ABI_EXPORT_CDECL(
69+
const std::function<void MONGOCXX_ABI_CDECL(const events::command_started_event&)>&)
6870
command_started() const;
6971

7072
///
@@ -82,14 +84,16 @@ class apm {
8284
/// method chaining.
8385
///
8486
MONGOCXX_ABI_EXPORT_CDECL(apm&)
85-
on_command_failed(std::function<void(const events::command_failed_event&)> command_failed);
87+
on_command_failed(
88+
std::function<void MONGOCXX_ABI_CDECL(const events::command_failed_event&)> command_failed);
8689

8790
///
8891
/// Retrieves the command failed monitoring callback.
8992
///
9093
/// @return The command failed monitoring callback.
9194
///
92-
MONGOCXX_ABI_EXPORT_CDECL(const std::function<void(const events::command_failed_event&)>&)
95+
MONGOCXX_ABI_EXPORT_CDECL(
96+
const std::function<void MONGOCXX_ABI_CDECL(const events::command_failed_event&)>&)
9397
command_failed() const;
9498

9599
///
@@ -108,14 +112,16 @@ class apm {
108112
///
109113
MONGOCXX_ABI_EXPORT_CDECL(apm&)
110114
on_command_succeeded(
111-
std::function<void(const events::command_succeeded_event&)> command_succeeded);
115+
std::function<void MONGOCXX_ABI_CDECL(const events::command_succeeded_event&)>
116+
command_succeeded);
112117

113118
///
114119
/// Retrieves the command succeeded monitoring callback.
115120
///
116121
/// @return The command succeeded monitoring callback.
117122
///
118-
MONGOCXX_ABI_EXPORT_CDECL(const std::function<void(const events::command_succeeded_event&)>&)
123+
MONGOCXX_ABI_EXPORT_CDECL(
124+
const std::function<void MONGOCXX_ABI_CDECL(const events::command_succeeded_event&)>&)
119125
command_succeeded() const;
120126

121127
///
@@ -133,14 +139,16 @@ class apm {
133139
/// method chaining.
134140
///
135141
MONGOCXX_ABI_EXPORT_CDECL(apm&)
136-
on_server_opening(std::function<void(const events::server_opening_event&)> server_opening);
142+
on_server_opening(
143+
std::function<void MONGOCXX_ABI_CDECL(const events::server_opening_event&)> server_opening);
137144

138145
///
139146
/// Retrieves the server opening monitoring callback.
140147
///
141148
/// @return The server opening monitoring callback.
142149
///
143-
MONGOCXX_ABI_EXPORT_CDECL(const std::function<void(const events::server_opening_event&)>&)
150+
MONGOCXX_ABI_EXPORT_CDECL(
151+
const std::function<void MONGOCXX_ABI_CDECL(const events::server_opening_event&)>&)
144152
server_opening() const;
145153

146154
///
@@ -158,14 +166,16 @@ class apm {
158166
/// method chaining.
159167
///
160168
MONGOCXX_ABI_EXPORT_CDECL(apm&)
161-
on_server_closed(std::function<void(const events::server_closed_event&)> server_closed);
169+
on_server_closed(
170+
std::function<void MONGOCXX_ABI_CDECL(const events::server_closed_event&)> server_closed);
162171

163172
///
164173
/// Retrieves the server closed monitoring callback.
165174
///
166175
/// @return The server closed monitoring callback.
167176
///
168-
MONGOCXX_ABI_EXPORT_CDECL(const std::function<void(const events::server_closed_event&)>&)
177+
MONGOCXX_ABI_EXPORT_CDECL(
178+
const std::function<void MONGOCXX_ABI_CDECL(const events::server_closed_event&)>&)
169179
server_closed() const;
170180

171181
///
@@ -184,14 +194,16 @@ class apm {
184194
/// method chaining.
185195
///
186196
MONGOCXX_ABI_EXPORT_CDECL(apm&)
187-
on_server_changed(std::function<void(const events::server_changed_event&)> server_changed);
197+
on_server_changed(
198+
std::function<void MONGOCXX_ABI_CDECL(const events::server_changed_event&)> server_changed);
188199

189200
///
190201
/// Retrieves the server description changed monitoring callback.
191202
///
192203
/// @return The server description changed monitoring callback.
193204
///
194-
MONGOCXX_ABI_EXPORT_CDECL(const std::function<void(const events::server_changed_event&)>&)
205+
MONGOCXX_ABI_EXPORT_CDECL(
206+
const std::function<void MONGOCXX_ABI_CDECL(const events::server_changed_event&)>&)
195207
server_changed() const;
196208

197209
///
@@ -210,14 +222,16 @@ class apm {
210222
///
211223
MONGOCXX_ABI_EXPORT_CDECL(apm&)
212224
on_topology_opening(
213-
std::function<void(const events::topology_opening_event&)> topology_opening);
225+
std::function<void MONGOCXX_ABI_CDECL(const events::topology_opening_event&)>
226+
topology_opening);
214227

215228
///
216229
/// Retrieves the topology_opening monitoring callback.
217230
///
218231
/// @return The topology_opening monitoring callback.
219232
///
220-
MONGOCXX_ABI_EXPORT_CDECL(const std::function<void(const events::topology_opening_event&)>&)
233+
MONGOCXX_ABI_EXPORT_CDECL(
234+
const std::function<void MONGOCXX_ABI_CDECL(const events::topology_opening_event&)>&)
221235
topology_opening() const;
222236

223237
///
@@ -235,14 +249,16 @@ class apm {
235249
/// method chaining.
236250
///
237251
MONGOCXX_ABI_EXPORT_CDECL(apm&)
238-
on_topology_closed(std::function<void(const events::topology_closed_event&)> topology_closed);
252+
on_topology_closed(std::function<void MONGOCXX_ABI_CDECL(const events::topology_closed_event&)>
253+
topology_closed);
239254

240255
///
241256
/// Retrieves the topology closed monitoring callback.
242257
///
243258
/// @return The topology closed monitoring callback.
244259
///
245-
MONGOCXX_ABI_EXPORT_CDECL(const std::function<void(const events::topology_closed_event&)>&)
260+
MONGOCXX_ABI_EXPORT_CDECL(
261+
const std::function<void MONGOCXX_ABI_CDECL(const events::topology_closed_event&)>&)
246262
topology_closed() const;
247263

248264
///
@@ -262,14 +278,16 @@ class apm {
262278
///
263279
MONGOCXX_ABI_EXPORT_CDECL(apm&)
264280
on_topology_changed(
265-
std::function<void(const events::topology_changed_event&)> topology_changed);
281+
std::function<void MONGOCXX_ABI_CDECL(const events::topology_changed_event&)>
282+
topology_changed);
266283

267284
///
268285
/// Retrieves the topology description changed monitoring callback.
269286
///
270287
/// @return The topology description changed monitoring callback.
271288
///
272-
MONGOCXX_ABI_EXPORT_CDECL(const std::function<void(const events::topology_changed_event&)>&)
289+
MONGOCXX_ABI_EXPORT_CDECL(
290+
const std::function<void MONGOCXX_ABI_CDECL(const events::topology_changed_event&)>&)
273291
topology_changed() const;
274292

275293
///
@@ -288,14 +306,16 @@ class apm {
288306
///
289307
MONGOCXX_ABI_EXPORT_CDECL(apm&)
290308
on_heartbeat_started(
291-
std::function<void(const events::heartbeat_started_event&)> heartbeat_started);
309+
std::function<void MONGOCXX_ABI_CDECL(const events::heartbeat_started_event&)>
310+
heartbeat_started);
292311

293312
///
294313
/// Retrieves the heartbeat started monitoring callback.
295314
///
296315
/// @return The heartbeat started monitoring callback.
297316
///
298-
MONGOCXX_ABI_EXPORT_CDECL(const std::function<void(const events::heartbeat_started_event&)>&)
317+
MONGOCXX_ABI_EXPORT_CDECL(
318+
const std::function<void MONGOCXX_ABI_CDECL(const events::heartbeat_started_event&)>&)
299319
heartbeat_started() const;
300320

301321
///
@@ -314,14 +334,16 @@ class apm {
314334
///
315335
MONGOCXX_ABI_EXPORT_CDECL(apm&)
316336
on_heartbeat_failed(
317-
std::function<void(const events::heartbeat_failed_event&)> heartbeat_failed);
337+
std::function<void MONGOCXX_ABI_CDECL(const events::heartbeat_failed_event&)>
338+
heartbeat_failed);
318339

319340
///
320341
/// Retrieves the heartbeat failed monitoring callback.
321342
///
322343
/// @return The heartbeat failed monitoring callback.
323344
///
324-
MONGOCXX_ABI_EXPORT_CDECL(const std::function<void(const events::heartbeat_failed_event&)>&)
345+
MONGOCXX_ABI_EXPORT_CDECL(
346+
const std::function<void MONGOCXX_ABI_CDECL(const events::heartbeat_failed_event&)>&)
325347
heartbeat_failed() const;
326348

327349
///
@@ -341,29 +363,34 @@ class apm {
341363
///
342364
MONGOCXX_ABI_EXPORT_CDECL(apm&)
343365
on_heartbeat_succeeded(
344-
std::function<void(const events::heartbeat_succeeded_event&)> heartbeat_succeeded);
366+
std::function<void MONGOCXX_ABI_CDECL(const events::heartbeat_succeeded_event&)>
367+
heartbeat_succeeded);
345368

346369
///
347370
/// Retrieves the heartbeat succeeded monitoring callback.
348371
///
349372
/// @return The heartbeat succeeded monitoring callback.
350373
///
351-
MONGOCXX_ABI_EXPORT_CDECL(const std::function<void(const events::heartbeat_succeeded_event&)>&)
374+
MONGOCXX_ABI_EXPORT_CDECL(
375+
const std::function<void MONGOCXX_ABI_CDECL(const events::heartbeat_succeeded_event&)>&)
352376
heartbeat_succeeded() const;
353377

354378
private:
355-
std::function<void(const events::command_started_event&)> _command_started;
356-
std::function<void(const events::command_failed_event&)> _command_failed;
357-
std::function<void(const events::command_succeeded_event&)> _command_succeeded;
358-
std::function<void(const events::server_closed_event&)> _server_closed;
359-
std::function<void(const events::server_changed_event&)> _server_changed;
360-
std::function<void(const events::server_opening_event&)> _server_opening;
361-
std::function<void(const events::topology_closed_event&)> _topology_closed;
362-
std::function<void(const events::topology_changed_event&)> _topology_changed;
363-
std::function<void(const events::topology_opening_event&)> _topology_opening;
364-
std::function<void(const events::heartbeat_started_event&)> _heartbeat_started;
365-
std::function<void(const events::heartbeat_failed_event&)> _heartbeat_failed;
366-
std::function<void(const events::heartbeat_succeeded_event&)> _heartbeat_succeeded;
379+
std::function<void MONGOCXX_ABI_CDECL(const events::command_started_event&)> _command_started;
380+
std::function<void MONGOCXX_ABI_CDECL(const events::command_failed_event&)> _command_failed;
381+
std::function<void MONGOCXX_ABI_CDECL(const events::command_succeeded_event&)>
382+
_command_succeeded;
383+
std::function<void MONGOCXX_ABI_CDECL(const events::server_closed_event&)> _server_closed;
384+
std::function<void MONGOCXX_ABI_CDECL(const events::server_changed_event&)> _server_changed;
385+
std::function<void MONGOCXX_ABI_CDECL(const events::server_opening_event&)> _server_opening;
386+
std::function<void MONGOCXX_ABI_CDECL(const events::topology_closed_event&)> _topology_closed;
387+
std::function<void MONGOCXX_ABI_CDECL(const events::topology_changed_event&)> _topology_changed;
388+
std::function<void MONGOCXX_ABI_CDECL(const events::topology_opening_event&)> _topology_opening;
389+
std::function<void MONGOCXX_ABI_CDECL(const events::heartbeat_started_event&)>
390+
_heartbeat_started;
391+
std::function<void MONGOCXX_ABI_CDECL(const events::heartbeat_failed_event&)> _heartbeat_failed;
392+
std::function<void MONGOCXX_ABI_CDECL(const events::heartbeat_succeeded_event&)>
393+
_heartbeat_succeeded;
367394
};
368395

369396
} // namespace options

0 commit comments

Comments
 (0)