//header file included from both C and C++ files #ifndef __cplusplus #include <stdbool.h> // for C99 type bool #endif #ifdef __cplusplus extern "C" { #endif void func(bool first, float min, float* state[6], float* err[6][6]); #ifdef __cplusplus } // extern "C" #endif
// cpp file #include "the_above_header.h" #include <vector> extern "C" void func(bool first, float min, float* state[6], float* err[6][6]); { //uses vectors and classes and other C++ constructs } // c file #include "the_above_header.h" int main() { bool b; float f; float *s[6]; float *err[6][6]; func(b,f,s,err); }
source share