Answer Posted / ravindranath m
The C++ compiler does something called as "name mangling"
for functions, while a C compiler does not. Name mangling
is a process wherein the name of the original function in a
c++ program gets changed to a new name via adding some
prefix and/or postfix to it.
As a result, a c program cannot find the required definition
when trying to link to a cpp object file.
This can be resolved by putting the following declaration in
a c++ header file that contains the cpp function declarations.
#ifdef __cplusplus
extern "C" {
#endif
// function declarations go here...
// ...
#ifdef __cplusplus
}
#endif
Is This Answer Correct ? | 25 Yes | 4 No |
Post New Answer View All Answers
Explain function overloading and operator overloading.
What do the keywords volatile and mean mutable?
Is map sorted c++?
What is #include iostream in c++?
What is a binary file? List the merits and demerits of the binary file usagein C++.
What is the array and initializing arrays in c++?
Define a pdb file.
Can we get the value of ios format flags?
What is difference between c++ 11 and c++ 14?
How are virtual functions implemented in c++?
What is a stack c++?
Write a program using display() function which takes two arguments.
What is a container class?
Is java the same as c++?
What is an iterator?