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 about vectors in c ++?
What is problem with overriding functions?
What is code reusability in c++?
What is a Default constructor?
Write syntax to define friend functions in C++.
What is a responder chain?
Which bitwise operator is used to check whether a particular bit is on or off?
How a macro differs from a template?
What is istream and ostream in c++?
Why do we learn c++?
What are the benefits of operator overloading?
When should we use container classes instead of arrays?
What is the use of 'using' declaration in c++?
What is the best ide for c++?
Differentiate between declaration and definition.