How to detect if C code (which needs 'extern C') is compiled in C++
The common practice is not to demand client code wraps your header in extern "C", but to do so conditionally yourself. For instance:
#ifdef __cplusplus extern "C" { #endif // Header content #ifdef __cplusplus } #endif
That way client code is automatically correct without doing anything beyond including the header.
Comments (0)