Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extern "C" missing from mosquitto_broker.h and mosquitto_plugin.h #1290

Closed
D-r-P-3-p-p-3-r opened this issue May 23, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@D-r-P-3-p-p-3-r
Copy link

commented May 23, 2019

This makes it a little tricky to write an auth-plugin in C++.

You have to include the files like this

extern "C" {
#include <mosquitto_broker.h>
}

or C++ name mangeling is going to get in your way, e.g. like this

mosquitto[1076]: Error: Unable to load auth plugin "/foo/auth.so".
mosquitto[1076]: Load error: /foo/auth.so: undefined symbol: _Z25mosquitto_client_usernamePK9mosquitto

Most likely all "public" headers should provide extern "C" support - like mosquitto.h does.

ralight added a commit that referenced this issue May 23, 2019

Add 'extern "C"' on public headers.
mosquitto_broker.h and mosquitto_plugin.h

Thanks to Wolfgang Petroschka.

Closes #1290.

@ralight ralight added this to the 1.6.3 milestone May 23, 2019

@ralight

This comment has been minimized.

Copy link
Contributor

commented May 23, 2019

Completely agree, thanks done now thanks very much.

@ralight ralight closed this May 23, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.