Link Properties:
when the individual source files that make up a program are compiled, all the target files and the functions referenced from one or more function libraries are linked together to form an executable program. However, if the same identifiers appear in several different source files, do they represent the same entity?
the link property of an identifier determines how to handle identifiers that appear in different files. The scope of the identifier is related to its linked properties, but not the same.
Link Properties There are 3 kinds of--external (external), internal (internal), none (none);
The
none(none) identifier is always treated as a separate individual, meaning that multiple declarations of that identifier are treated as separate entities.
Internal(internal) identifiers all declarations within the same source file point to the same entity, but multiple declarations in different source files belong to different entities.
External(external) identifiers, no matter how many times they are declared, are located in several source files representing the same entity.
The link properties are described in all the different ways in which the name declaration is shown. By default, the link property for identifiers B, C, and F is external, and the remaining identifiers have a link property of None. Therefore, if another source file also contains a similar declaration of identifier B and calls function C, they actually access the entity defined by the source file. The link property of f is external because it is a function name. Calling function f in this source file will actually link to the function defined by the other source file, and even the definition of the function may appear in a function library.
To
Modify a link property:
The keyword extern and static are used to modify the link property of an identifier in a declaration. If a claim has a external link property under normal conditions, the static keyword before it can make its Link property internal. such as: static int b;
Then the variable B will be private to the source file. In other source files, if you also link to a variable called B, then it refers to a different variable. Similarly, you can declare a function as static, such as:
static int c (int d);
this will prevent it from being called by other source files.
Static changes the effect of link properties only for declarations with the default link property of external. For example, although you can add static before declaration 5
keyword, but its effect is completely different, because the link property of E is not external. The rules for the extern keyword are complex. It specifies the external link property for an identifier so that it can access the entity defined at any other location.
From for notes (Wiz)
A detailed description of the link properties of Linux C notes