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
How does a C++ structure differ from a C++ class?
Differentiate between an inspector and a mutator ?
Explain the term memory alignment?
Why can templates only be implemented in the header file?
program explaining feautures of c++
Write a program for Divide a number with 2 and Print the output ( NOTE: Check for divide by zero error).
Which software is best for coding?
Name four predefined macros.
Which is the best c++ compiler?
Can you please explain the difference between using macro and inline functions?
Which programming language should I learn first?
Differences between private, protected and public and give examples.
Write a single instruction that will store an EVEN random integer between 54 and 212 inclusive in the variable myran. (NOTE only generate EVEN random numbers)
Tell me what are static member functions?
What are the four main data types?