4 ms·
This is by and large a very minor point. I typically define a macro similar to this: #ifdef __cplusplus #define CFUN extern "C" #else #define CFUN #e
by pmjordan 14y ago
This is by and large a very minor point. I typically define a macro similar to this:
#ifdef __cplusplus
#define CFUN extern "C"
#else
#define CFUN
#endif
and mark any C-callable functions with it. Easy. The real linkage problems you'll run into with C++ are in dynamic libraries. The higher level of abstraction hides some problems that are really obvious at the C level. Fortunately, you only need to care about this if you need to support third-party plugins to your software. If that's the case, you may want to reconsider your choice of using a low-level language such as C++ or C.