I have a STRUCT (DUT) which one element is an interface.
STRUCT myStruct
element : iInterf;
END_STRUCT
In declaration session, I have to instantiate first (with same implementation) before assign value to this element.
instance : iInterf_implementation := (some initialization values);
myVar : myStruct := ( element := instance );
Is possible to assign value and instantiate an interface element without create another variable?
Not that I know of. Here's a quote from the CODESYS documentation: CODESYS always treats variables declared with the type of an interface as references
. If an interface is essentially a reference, which is essentially a pointer, then you need a variable for the interface to refer/point at.