Attribute linkalways

Overview

Use the pragma {attribute 'linkalways'} to mark POUs or global variable lists for the compiler in a way so that they are always included into the compile information. As a result, objects with this option will always be compiled and downloaded to the controller. The compiler option Link always affects the same.

Syntax

{attribute 'linkalways'}

When you use the symbol configuration editor, the marked POUs are used as a basis for the selectable variables for the symbol configuration.

Example

The global variable list GVLMoreSymbols is implemented making use of the attribute 'linkalways':

{attribute 'linkalways'}
VAR_GLOBAS
g_iVar1: INT;
g_iVar2: INT;
END_VAR

With this code, the symbols of GVLMoreSymbols become selectable in the Symbol configuration.