Sensirion / gas-index-algorithm

Sensirion's Gas Index Algorithm provides a VOC and NOx Index output signal calculated from the SGP40/41 raw signals
https://sensirion.github.io/gas-index-algorithm/
BSD 3-Clause "New" or "Revised" License
17 stars 11 forks source link

Add extern "C" blocks in header files for C++ compatibility #10

Closed gabortim closed 1 year ago

gabortim commented 1 year ago

The header files of the library currently lack extern "C" {} block, making it tricky to use in C++ projects. To improve compatibility, I propose adding the following to the library's header files:

#ifdef __cplusplus
extern "C" {
#endif

// existing header content

#ifdef __cplusplus
}
#endif

This change ensures that the library can be linked in C++ projects without encountering name mangling issues.

Reference: Stack Overflow - Explanation of extern "C".

psachs commented 1 year ago

Thank you for the suggestion. We will add a c++ header guard to ensure out-of-the box compatibility with c++ programs.