Detailed explanation of the role of extern C

The main function of extern "C" is to correctly implement C++ code to call other C language code. After adding extern "C", it will instruct the compiler to compile this part of the code according to the C language , not C++. Since C++ supports function overloading, the compiler will add the parameter type of the function to the compiled code during the process of compiling the function, not just the function name; and the C language does not support function overloading, so compiling C The function of the language code does not carry the parameter type of the function, generally including the function name.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327045147&siteId=291194637