Linkage in c++
-
What is linkage and what is use of internal linkage and external linkage? rajesh
-
What is linkage and what is use of internal linkage and external linkage? rajesh
The notion of linkage is kind of complicated because the word describes code properties that can be understood within several different contexts. The most obvious is referring to the compiling process when the LINKER is invoked to supply code linking the object files in your project to another existing external binary Library (typically a DLL) of funtions and resources. Another distinct context for the term 'linkage' involves the using terms like 'extern' preceeding function prototypes being imported via P/Invoke, or Interop, (unmanaged code being inserted into a managed environment). This merely prevents the Visual Studio compiler from managling the name of the function. This is referred to as 'specifying linkage'. I frankly hate the language that Microsoft engineers use to describe their technologies. It can be, and often is, confusing as hell. I suggest you be more specific about the context in which the term is being used. In this case, I have described only two of possibly a dozen or more conventional usages. But, generally speaking, internal linkage is similar to execution scope, and external linkage refers to separate compiled binary entities and dependencies in other programming languages or compiled by other vendor compilers. You might find this article helpful: Mixed Language Programming and External Linkage[^]