What is name mangling?

Any functions declared in C++ are decorated or renamed before compilation by compiler.
This is done to used the function overloading. We can declare function with similar names but with different argument type, number or order. To achieve this compiler internally rename this functions to distinct from each other. This is called as Name Mangling.
To prevent C++ compiler from mangling name one can provide extern "C" keword preceding the function declaration. This is the reason why one need to provide extern "C" keywor

No comments: