'Codesys 3 : Return variable address and size from string containing symbol name of said variable?

I want to take a string that contains the symbol name of a variable and somehow get the address and size of the variable with that symbol name.

MyDINT:= 5;
MySymbolName:= `MyDINT`;

VariableInfo:= SomeFunctionImLookingFor(MySymbolName);
MyDINTPointer ACCESS VariableInfo.Address;
MyDINTSize:= VariableInfo.Length;

NOTE: This is different from __VARINFO(MyDINT); because I would be passing the symbol name MyDINT as a string.

EDIT: This is obviously not my use case, just the simplest possible example. I find it curious that there is a function that will return a symbol name as a string but not one that goes the other way around.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source