Handling a C and a C++ file in a project?

Hi,

I have a project for Borland C++, and it has a C++ file and a C file. The C++ file cannot acess the C file functions, even though I have a header file that has the prototype. It works when they're both C, or C++, but the problem is one of them requires to be C++ and the other requires to be C (which is because of a loop, it's including a library that was for C, therefore the header file isn't compatible with C++!).

So what do I have to put on my prototype to get it to be compatible with the C++? Is it even possible?

I've not had to deal with this issue myself, but here's what the problem might be. Mind you, I'm having to remember back several years for this one.

In order to support function overloading (using the same function name for different functions with different argument types), C++ performs "name mangling" on the function names within the object and library files, wherein the argument-list types are appended onto the function names in order to give each overloaded function a unique name. C does not do this.

So if a C library or object file needs to be linked into a C++ program, the keyword cdecl (or __cdecl in VC++6) is used to indicate that you're using a C call instead of C++. You can also cdecl an entire block of function prototypes.

Hm, strangely enough, my compiler (Borland) has this as documentation for "extern":

Syntax

extern <data definition> ;
[extern] <function prototype> ;

Description

Use the extern modifier to indicate that the actual storage and initial value of a variable, or body of a function, is defined in a separate source code module. Functions declared with extern are visible throughout all source files in a program, unless you redefine the function as static.
The keyword extern is optional for a function prototype.
Use extern "c" to prevent function names from being mangled in C++ programs.