Unfortunately, "extern C" doesn't do what you want it to do - it doesn't
compile the functions as C, which I guess you have seen. However, what it
does do is tell the C++ compiler that functions with these names _will
have been compiled by a C compiler_ elsewhere. Then, you should
be able to link the objects produced by the C compiler, with the objects
produced by the C++ compiler. So you shouldn't have to rename your .c
files to .cpp files to use them in your C++ program. There's more about
this in the FAQ:
http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html
Have you tried compiling your .c files with the .c, and linking them with
your .cpp files? You do something like this:
--- cfunctions.c ---
int my_c_function()
{
/* Do some C stuff here */
}
--- cfunctions.h ---
#ifdef __cplusplus
extern "C" {
#endif
int my_c_function();
#ifdef __cplusplus
}
#endif
--- cppfunction.cpp ---
#include "cfunctions.h"
int my_cpp_function()
{
int i = my_c_function();
// Do some C++ stuff here
}
---
And you would compile them with:
# Compile the C functions with a C compiler
cc -c cfunctions.c -o cfunctions.o
# Compile the C++ functions with a C++ compiler
c++ -c cppfunctions.cpp -o cppfunctions.o
# Use the C++ compiler to link the C and C++ functions together into a
# program
c++ -o program cfunctions.o cppfunctions.o