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
Can you write a function similar to printf()?
Is java based off c++?
How do you clear a set in c++?
How to demonstrate the use of a variable?
Are c and c++ different?
What are multiple inheritances (virtual inheritance)?
What does the ios::ate argument do?
What are member functions used in c++?
Why do we use the using declaration?
Is c++ a software?
What is the basic structure of c++ program?
Can class objects be passed as function arguments?
What is fflush c++?
What is function overriding in c++?
How can a called function determine the number of arguments that have been passed to it?