From 00eee59ad9d58fd2ba28ca40efc79a7ff8b41ffd Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 23 May 2019 11:03:09 +0100 Subject: [PATCH] Add 'extern "C"' on public headers. mosquitto_broker.h and mosquitto_plugin.h Thanks to Wolfgang Petroschka. Closes #1290. --- ChangeLog.txt | 2 ++ src/mosquitto_broker.h | 8 ++++++++ src/mosquitto_plugin.h | 10 ++++++++++ 3 files changed, 20 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index fa89062a..39d1329d 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -16,6 +16,8 @@ Broker: Closes #1273. - Improve documentation around the upgrading of persistence files. Closes #1276. +- Add 'extern "C"' on mosquitto_broker.h and mosquitto_plugin.h for C++ plugin + writing. Closes #1290. Client library: - Fix typo causing build error on Windows when building without TLS support. diff --git a/src/mosquitto_broker.h b/src/mosquitto_broker.h index d8e41f73..f6f2cc86 100644 --- a/src/mosquitto_broker.h +++ b/src/mosquitto_broker.h @@ -17,6 +17,10 @@ Contributors: #ifndef MOSQUITTO_BROKER_H #define MOSQUITTO_BROKER_H +#ifdef __cplusplus +extern "C" { +#endif + #include struct mosquitto; @@ -161,4 +165,8 @@ const char *mosquitto_client_username(const struct mosquitto *client); */ int mosquitto_set_username(struct mosquitto *client, const char *username); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/mosquitto_plugin.h b/src/mosquitto_plugin.h index a07b75b7..83e55ebd 100644 --- a/src/mosquitto_plugin.h +++ b/src/mosquitto_plugin.h @@ -17,6 +17,10 @@ Contributors: #ifndef MOSQUITTO_PLUGIN_H #define MOSQUITTO_PLUGIN_H +#ifdef __cplusplus +extern "C" { +#endif + #define MOSQ_AUTH_PLUGIN_VERSION 4 #define MOSQ_ACL_NONE 0x00 @@ -305,4 +309,10 @@ int mosquitto_auth_psk_key_get(void *user_data, struct mosquitto *client, const int mosquitto_auth_start(void *user_data, struct mosquitto *client, const char *method, bool reauth, const void *data_in, uint16_t data_in_len, void **data_out, uint16_t *data_out_len); int mosquitto_auth_continue(void *user_data, struct mosquitto *client, const char *method, const void *data_in, uint16_t data_in_len, void **data_out, uint16_t *data_out_len); + + +#ifdef __cplusplus +} +#endif + #endif