From 8433fa047fdec166b051a8d9a9805138c93dacf9 Mon Sep 17 00:00:00 2001 From: Jonathan Reichelt Gjertsen Date: Tue, 10 May 2022 15:52:56 +0200 Subject: [PATCH] Support C++ Wrapping the header file in an `extern "C"` block prevents C++ compilers from mangling the function names. --- nanomodbus.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nanomodbus.h b/nanomodbus.h index 95fe989..323be79 100644 --- a/nanomodbus.h +++ b/nanomodbus.h @@ -44,6 +44,10 @@ #include #include +#ifdef __cplusplus + extern "C" { +#endif + /** * nanoMODBUS errors. * Values <= 0 are library errors, > 0 are modbus exceptions. @@ -375,5 +379,8 @@ nmbs_error nmbs_receive_raw_pdu_response(nmbs_t* nmbs, void* data_out, uint32_t const char* nmbs_strerror(nmbs_error error); #endif +#ifdef __cplusplus + } // extern "C" +#endif #endif //NANOMODBUS_H