User manual
mikroC PRO for dsPIC
MikroElektronika
227
Linkage Rules
Local names have internal linkage; the same identier can be used in different les to signify different objects. Global
names have external linkage; identier signies the same object throughout all program les.
If the same identier appears with both internal and external linkage within the same le, the identier will have internal
linkage.
Internal Linkage Rules
1. names having le scope, explicitly declared as static, have internal linkage
2. names having le scope, explicitly declared as const and not explicitly declared as extern, have
internal linkage
3. typedef names have internal linkage
4. enumeration constants have internal linkage
External Linkage Rules
1. names having le scope, that do not comply to any of previously stated internal linkage rules, have
external linkage
The storage class speciers auto and register cannot appear in an external declaration. No more than one external
denition can be given for each identier in a translation unit declared with internal linkage. An external denition is
an external declaration that denes an object or a function and also allocates a storage. If an identier declared with
external linkage is used in an expression (other than as part of the operand of sizeof), then exactly one external
denition of that identier must be somewhere in the entire program.
Storage Classes
Associating identiers with objects requires each identier to have at least two attributes: storage class and type
(sometimes referred to as data type). The mikroC PRO for dsPIC30/33 and PIC24 compiler deduces these attributes
from implicit or explicit declarations in the source code.
A storage class dictates the location (data segment, register, heap, or stack) of object and its duration or lifetime (the
entire running time of the program, or during execution of some blocks of code). A storage class can be established by
the syntax of a declaration, by its placement in the source code, or by both of these factors:
storage-class type identier
The storage class speciers in the mikroC PRO for dsPIC30/33 and PIC24 are:
- auto
- register
- static
- extern