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
What is the difference between an array and a list?
What is vector string in c++?
What is setbase c++?
Explain the differences between private, public and protected and give examples.
Define Virtual function in C++.
Why is c++ is better than c?
What are the uses of typedef in a program?
What are the differences between new and malloc?
How many different levels of pointers are there?
What is the use of endl in c++ give an example?
What are friend functions in C++?
Describe public access specifiers?
What is command line arguments in C++? What are its uses? Where we have to use this?
What do you mean by early binding?
What's the most powerful programming language?