Skip to main content

Attribute: call_before_global_exit_slot

Important

VAR_INPUT declarations in functions or methods that use the attribute lead to compile errors. Reason: Input variables are unknown in this case at the time of the call, which occurs implicitly during the online change.

Important

Functions marked with this attribute will be executed only if they have been compiled and downloaded to the controller.

If your function is not called anywhere else in your project, then the compiler can exclude the function from the build. To make sure that the function is always compiled and available for execution, add the pragma {attributeĀ 'linkalways'} to the function declaration.

Alternatively, you could also enable the Link always option in the properties dialog of the function on the Build tab.

Without this option, your initialization function might not run, even though it appears to be configured correctly.

The effect of this pragma is that all functions and programs where this attribute is set are called before the GlobalExit. GlobalExit takes place before a new download or a reset. Function blocks provided with an FB_Exit method are affected. The order of calling is defined by means of the attribute value.

If the attribute is set in a method, then all instances of the parent function block are determined. All instances are called in the specified slot. In this case, you have no influence on the order of the instances among themselves.

Syntax:

{attribute 'call_before_global_exit_slot' := '<slot>'}

Insert location

First line above the declaration part of functions and programs

<slot>

Integer value that defines the ranking in the order of the calls; the lower the value, the earlier the call takes place. If several function blocks have the same ranking for the attribute, then the order of their calls remains indefinite.