cpp/language/language linkage

Provides for linkage between program units written in different programming languages.

@1@ Applies the language specification to all function types, function names with external linkage and variables with external linkage declared in. @2@ Applies the language specification to a single declaration or definition.

Explanation
Every function type, every function name with, and every variable name with , has a property called language linkage. Language linkage encapsulates the set of requirements necessary to link with a program unit written in another programming language:, (name decoration) algorithm, etc.

Only two language linkages are guaranteed to be supported:
 * 1) "C++", the default language linkage.
 * 2) "C", which makes it possible to link with functions written in the C programming language, and to define, in a C++ program, functions that can be called from the units written in C.

Since language linkage is part of every function type, pointers to functions maintain language linkage as well. Language linkage of function types (which represents calling convention) and language linkage of function names (which represents name mangling) are independent of each other:

Two functions with the same name and the same parameter list in the same namespace cannot have two different language linkages (note, however, that linkage of a parameter may permit such overloading, as in the case of std and std). Likewise, two variables in the same namespace cannot have two different language linkages.

Special rules for "C" linkage
When class members or non-static member functions appear in a "C" language block, the linkage of their types remains "C++" (but parameter types, if any, remain "C"):

When a function or a variable is declared (in any namespace) with "C" language linkage, all declarations of functions (in any namespace) and all declarations of variables in global scope with the same unqualified name must refer to the same function or variable.