Linkage (software)
From Wikipedia, the free encyclopedia
| This article or section is in need of attention from an expert on the subject. Please help recruit one or improve this article yourself. See the talk page for details. Please consider using {{Expert-subject}} to associate this request with a WikiProject |
In programming languages, particularly C++, linkage describes how symbols are represented in an executable or object file.
The static keyword is used in C to restrict a function or global variable to file scope (internal linkage). This is also valid in C++, although C++ deprecates this usage in favor of anonymous namespaces (which are not available in C). Also, C++ implicitly treats any const global as file scope unless it is explicitly declared extern, unlike C in which extern is the default. Conversely, inline functions in C are of file scope whereas they have external linkage by default in C++.
A symbol's linkage is related to, but distinct from, its scope. For instance, a symbol with global scope may have internal linkage, making it accessible within one file only, or external linkage, making it accessible within other files that reference it externally.
Linkage between languages must be done with some care, as different languages adorn their external symbols differently.

