Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

C0564 Warning Message

2024-01-25
2024-01-30
  • masmith1553 - 2024-01-25

    Hello,

    After updating from SP18 to SP19 I am receiving multiple C0564 warning messages after I compile. Does anyone know how to fix the warnings?

     
  • r-niedermayer

    r-niedermayer - 2024-01-30

    Please see or Online Help on how to initialize variable before using them:

    https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_pragma_attribute_global_init_slot.htmlΒ 


    Regarding the Attribute global_init_slot:

    You can use this pragma to influence the order in which signatures are processed during global initialization. It can only be applied to signatures.Β 

    By default, the initialization sequence for variables from global variable lists is undefined!

    However, if, for example, variables from one list depend on variables from another list, it is necessary to initialize one before the other.

    (Aee OLH and Syntax) The placeholder <slot> must be replaced by an integer value that defines the position in the initialization sequence.</slot>

    The default value is 50000.

    A lower value causes an earlier initialization!
    If several signatures have the same value for the 'global_init_slot' attribute, the order of their initialization remains undefined!Β 

    Cautious application should therefore be considered!


    Example: The project contains f.e. two global variable lists GVL_1 and GVL_2. The global variable "A" is part of the global variable list GVL_1:

    {attribute 'global_init_slot' := '300'}
    VAR_GLOBAL 
      A : INT:=1000;
    END_VAR
    

    The initialization values of the variables "B" and "C" of GVL_2 are dependent on the variable "A".

    {attribute 'global_init_slot' := '350'}
    VAR_GLOBAL
    Β  B : INT:=A+1;
    Β  C : INT:=A-1;
    END_VAR
    

    So if you set the 'global_init_slot' attribute of the global variable list GVL_1 to 300, i.e. to the lowest initialization value in the example, then it is ensured that the expression "A+1" is well-defined at the time of initialization of "B".

     

    Last edit: r-niedermayer 2024-01-30
    • masmith1553 - 2024-01-30

      Thank you for the reply. I was able to use this attribute in both of my Network Variable List Sends to clear the warnings.

       

Log in to post a comment.