SLAU132V October 2004 – February 2020
The WEAK pragma gives weak binding to a symbol.
The syntax of the pragma in C is:
#pragma WEAK (symbol) |
The syntax of the pragma in C++ is:
#pragma WEAK |
The WEAK pragma makes symbol a weak reference if it is a reference, or a weak definition, if it is a definition. The symbol can be a data or function variable. In effect, unresolved weak references do not cause linker errors and do not have any effect at run time. The following apply for weak references:
A weak definition does not change the rules by which object files are selected from libraries. However, if a link set contains both a weak definition and a non-weak definition, the non-weak definition is always used.
The WEAK pragma has the same effect as using the weak function or variable attribute. See Section 5.17.2 and Section 5.17.3, respectively.