VAR_EXTERNAL blocks have no effect
Variables declared in a VAR_EXTERNAL
block are currently ignored and the referenced globals will be used instead.
Example:
VAR_GLOBAL
myArray : ARRAY [0..10] OF INT;
myString: STRING;
END_VAR
FUNCTION main
VAR_EXTERNAL CONSTANT
myArray : ARRAY [0..10] OF INT;
END_VAR
myArray[5] := 42;
myString := 'Hello, world!';
END_FUNCTION
In this example, even though arr
is declared as VAR_EXTERNAL CONSTANT
, the CONSTANT
constraint will be ignored and
the global myArray
will be mutated. The global myString
can be read from and written to from within main
even though it
is not declared in a VAR_EXTERNAL
block.