How can I create a C++ function f(int,char,float) that is callable by my C code?
The C++ compiler must know that f(int,char,float) is to be called by a C compiler using the extern C construct: // This is C++ code // Declare f(int,char,float) using extern C: extern “C” void f(int i, char c, float x); // … // Define f(int,char,float) in some C++ module: void f(int i, char c, float x) { // … } The extern C line tells the compiler that the external information sent to the linker should use C calling conventions and name mangling (e.g., preceded by a single underscore). Since name overloading isn’t supported by C, you can’t make several overloaded functions simultaneously callable by a C program.