The RETAIN pragma can be applied to a code or data symbol.
It causes a .retain directive to be generated into the section that contains the definition of the symbol. The .retain directive indicates to the linker that the section is ineligible for removal during conditional linking. Therefore, regardless whether or not the section is referenced by another section in the application that is being compiled and linked, it will be included in the output file result of the link.
The RETAIN pragma has the same effect as using the retain function or variable attribute. See Section 5.17.2 and Section 5.17.3, respectively.
The syntax of the pragma in C is:
#pragma RETAIN ( symbol ) |
The syntax of the pragma in C++ is:
#pragma RETAIN |