Linkage


The C++ language classifies programming objects into two categories:

The linkage of an object controls its visibility to translation units other than that in which it was defined. Objects with internal linkage are accessible only within the translation unit in which they are defined. The name of an object with internal linkage is not exported to the linker; rather, it is translated by the compiler into a relocatable address and used only in that form. Objects with external linkage may be defined in one translation unit and made accessible (via a header) to other translation units. By default, functions have external linkage (except, that is, for inlined functions).

The C++ language has features for controlling the linkage of objects. The storage class specifiers static and extern are used to affect the linkage of objects. The constant type specifier also influences the linkage type of an object, as does the global or local status of a declared variable.