Skip to main content

Compiler Warning C0571

Message: FB_EXIT of instances in VAR_RETAIN is also called during Reset warm, but not FB_INIT. Avoid retain declaration of function blocks with FB_EXIT!

Possible error cause: An instance of a unction block, which has an FB_Exit method, is declared in VAR_RETAIN.

Error correction: Avoid retain declarations of function blocks with FB_EXIT.

Example 502. Example of the warning
FUNCTION_BLOCK POU
...
METHOD FB_Exit: BOOL
VAR_INPUT
      bInCopyCode : BOOL;
END_VAR
...
FUNCTION_BLOCK POU_1
VAR
      inst2 : POU;
END_VAR
...
PROGRAM PLC_PRG
VAR
      myFB : POU_1;
END_VAR
myFB();

The declaration of the variable myFB produces the following warning.

Message:

C0571: FB_EXIT of instances in VAR_RETAIN is also called during Reset warm, but not FB_INIT. Avoid retain declaration of function blocks with FB_EXIT!