If you #include your C into a C++ file to compile then your C will get mangled. There are 2 ways around this:
1) Keep your C in separate files, compile them as C into .o files, then make .o files from your C++, and then link them together
2) Put the things you don't wan't mangled into this:
Code:
extern "C"
{
//C is safe here!
}
That second way you can even put some of your C++ declarations in there, then define them outside of it using C++:
Code:
extern "C"
{
void *getHandle();
//Can only do C here...
}
void *getHandle()
{
//But I can put C++ in the definition here!
}
By the way, name mangling only really matters if you are building a shared library or something that you will link to from other programs. If you don't do that, you don't really have to worry about it; even though g++ mangles C++ names, it's consistent, so it knows what all the mangled names are supposed to be.
ta0kira