Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Using C++ with the Paho C client library

Yeah, it's a no-brainer adding the extern "C" definition.  I've known people use C++ compilers but really only use C.

Ian


On 16/05/13 17:26, Roger Light wrote:

Hi Ian,

(1) Make the headers C++ aware internally:
#if defined(__cplusplus)
extern "C" {
#endif
Once the C++ wrapper is written, then C++ programs can use that, and this would become moot.  I have a preference for keeping C++ related stuff out of the C code, but I can see the logic.

This one is pretty trivial, is fully C-conformant, and is fairly common in C libraries these days. It just helps the C++ programmer in not having to remember which headers need to be wrapped. It's not that you're adding any C++ to the header, but rather just making it safe for a C++ app to use directly.

I think that a number of C++ apps might still use the C library directly even if there were a C++ wrapper available.

I'm with Frank on this one. It's trivial to add and does no harm. I've definitely got people using libmosquitto in their C++ code rather than the wrapper, although there may be other reasons for that choice of course.

Regards,

Roger


_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/paho-dev


Back to the top