There seems to be several ways to get a string of a symbol name (__VARINFO, {attribute 'instance-path'}, etc), but I can't seem to find a method of using a string of a symbol name to do anything. I'm specifically interested in using the string of a symbol name to get the address and size of the symbol. Is this possible in Codesys?
Currently, I sidestep this issue by manually generating code that returns the address and length of each item. However, my array of strings is automatically generated (so requiring zero effort/changes to use the code), so it would be nice to not need to manually alter this code to add ADR() and SIZEOF() calls.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There seems to be several ways to get a string of a symbol name (
__VARINFO
,{attribute 'instance-path'}
, etc), but I can't seem to find a method of using a string of a symbol name to do anything. I'm specifically interested in using the string of a symbol name to get the address and size of the symbol. Is this possible in Codesys?Currently, I sidestep this issue by manually generating code that returns the address and length of each item. However, my array of strings is automatically generated (so requiring zero effort/changes to use the code), so it would be nice to not need to manually alter this code to add
ADR()
andSIZEOF()
calls.