An answer to your second question:
There are two solutions for passing an array reference without passing the whole array while not using pointers:
- Use VAR_IN_OUT - this forces the inclusion of the variable on every call and uses by reference behind the scenes. The downside is if you really just want a var input, you could adjust the value inside the FB without problems and create bugs.
- Use the keyword REFERENCE TO when you define your variable. It will pass the variable by reference and you can use it for VAR_INPUT, VAR_OUTPUT, and VAR. I put an example below. Be aware you should still check for validity of the reference in case it has never been set! Hint - if you only use REFERENCE TO in Method VAR_INPUTS, the programmer must assign it, so you don’t have to check validity!
History : REFERENCE TO ARRAY[0..99] OF DWORD;