LiamBindle / MQTT-C

A portable MQTT C client for embedded systems and PCs alike.
https://liambindle.ca/MQTT-C
MIT License
768 stars 270 forks source link

Improve Compatibility with C++ Applications #93

Closed nsi-ltd closed 4 years ago

nsi-ltd commented 4 years ago

When trying to use this code with a C++ application the runtime was failing to find any exported function. On inspection the typical construct that is added to header files was found to be missing. This should be applied to mqtt.h and mqtt_pal.h

#ifndef __MQTT_H__
#define __MQTT_H__

#ifdef __cplusplus
extern "C" {
#endif

<rest of code>

#ifdef __cplusplus
}
#endif

#endif
LiamBindle commented 4 years ago

@nsi-ltd I'd support this. I'm happy to merge a PR with this update :smile:

nsi-ltd commented 4 years ago

Hi Liam,

Thank you for your support and efforts in producing this project.

LiamBindle commented 4 years ago

Fixed by @markrad in #102.

Thanks for opening @nsi-ltd