How do you link a C++ program to C functions?

Answer Posted / nikhil upadhyay

By using the extern "C" linkage specification around the C function declarations.
Programmers should know about mangled function names and type-safe linkages. Then they should explain how the extern "C" linkage specification statement turns that feature off during compilation so that the linker properly links function calls to C functions. Another acceptable answer is "I don't know. We never had to do that." Merely describing what a linker does indicates that the programmer does not understand the issue that underlies the question.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the disadvantage of using a macro?

589


How do you declare A pointer to function which receives an int pointer and returns a float pointer

672


Why do we use constructor?

591


What is the use of function pointer?

568


What is a singleton c++?

545






what does the following statement mean? int (*a)[4]

613


What is the role of static keyword for a class member variable?

625


What operators can you overload in c++?

592


an operation between an integer and real always yeilds a) integer result b) real result c) float result

704


What is a lambda function c++?

549


What is else syntax in c++?

636


Explain how overloading takes place in c++?

568


When are exception objects created?

607


Describe new operator and delete operator?

622


What is dynamic and static typing?

665