1.C calling a C + + function or variable
C calls C + + functions or variables, the header file in C + + is declared as extern "C", and C is called using only the extern declaration.
As can be seen, extern "C" tells the C + + compiler to use the C link rule to generate and find the symbol name in the target file.
In short, the extern "C" {}, declared in C + +, tells the compiler to generate (or look for) the target symbol in the way that the function or variable declared in {} uses C.
3. C + + calls inline function
When a function in C is declared as an inline function using __inline, it does not link to the target symbol.
The function in EXAMPLE_C.C is changed to __inline void Print_c (int i) and the print_c symbol is not found in example_c.obj.
You can use a declaration such as __declspec (dllexport) __inline void print_c (int i) to generate the target symbol External | _print_c.
C&c++--extern