Skip to main content

Attribute: linkalways

The pragma {attribute 'linkalways'} instructs the compiler to always include a POU or a library POU in the compile information. During the build, the POU is compiled and is part of the application code. During the download, the POU is downloaded to the PLC.

Syntax:

{attribute 'linkalways'}

Insertion location: The first line in the declaration part of the POU or library POU

The POU may be valid throughout the project (saved in the POUs view) or throughout the application (saved in the Devices view).

Tip

You can also select the Link always option in the Build tab of a POU's object properties.

Example 277. Example

The MoreSymbols GVL contains the pragma {attribute 'linkalways'}. The variables declared there are also part of the application code, regardless of any access.

GVL MoreSymbols

{attribute 'linkalways'}
VAR_GLOBAL
        g_iAlfa: INT;
        g_iBravo: INT;
        g_iCharlie: INT;
END_VAR

The symbol configuration also accesses the compile information. As a result, the variables of the MoreSymbols GVL are always provided for selection in the Symbol Configuration editor.

_cds_img_pragma_linkalways_symbolcon.png