Attribute ‘linkalways’ΒΆ

The effect of this pragma is that the associated object is marked with the compiler and is thus always contained in the compiler information. This means that the object is always compiled and loaded to the PLC. The pragma works for POUs and GVLs that are located below an application or in libraries below an application or are contained in the POUs view. The Always link option in the Compile category of the object properties has the same effect.

Syntax:

{attribute 'linkalways'}

Insertion position: the line above the line with the keyword VAR_GLOBAL in the declaration part of POUs and GVLs.

If you use the symbol configuration editor, CODESYS uses the marked POU as the basis for the selectable variables of the symbol configuration used.

Example

The implementation of the global variable list GVLMoreSymbols uses the attribute 'linkalways':

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

Through this code the variables of GVLMoreSymbols are made available as selectable symbols.

See also