Attribute 'linkalways'

The pragma causes the associated object to be selected by the compiler and is thus always contained in the compiler information. This means that the object is always compiled and loaded on the PLC. The option Always link in the object properties, category Advanced, has the same effect.

Syntax: {attribute 'linkalways'}

Insertion location:

POU: First line above the declaration part of the POU

GVL: Line above the line with the keyword VAR_GLOBAL in the declaration part

Example:

Implementation of a POU (here: program) that uses the attribute 'linkalways':

{attribute 'linkalways'} 
PROGRAM PRG_Test 
    bSample : BOOL;
END_VAR 

Implementation of a global variable list using the attribute 'linkalways':

{attribute 'linkalways'} 
VAR_GLOBAL 
    nVar1 : INT;  
    nVar2 : INT; 
END_VAR