July 12th, 2013, 12:18 AM
Question on name mangling?
How come sometimes I don't use declarations like extern "C", the Visual C++ compiler doesn't complain about a C++ method calling a C function? Is it because of variant compilers? because I've got name mangling problem when using mingw64 on the same set of source code.
Last edited by lucky6969b; July 12th, 2013 at 12:28 AM.
July 12th, 2013, 10:10 AM
Re: Question on name mangling?
Maybe because the function is a C++ function that you're calling, and not a 'C' function?
Originally Posted by lucky6969b
If you don't use extern "C", the function will be regarded as a C++ function, regardless of how "C-ish" the function looks internally. So why should the compiler complain? Not using extern "C" means that the function can be overloaded, thus some name mangling scheme is used by the compiler to allow the linker to disambiguate functions that share the same name but have a different signature.
Click Here to Expand Forum to Full Width