Queryinterface, L-force | plc designer – Lenze PLC Designer PLC Designer (R3-1) User Manual

Page 1086

Advertising
background image

L-force | PLC Designer

Programming Reference

1084

DMS 4.1 EN 03/2011 TD29

Example with an array:

PLC_PRG(PRG)
VAR
bInit: BOOL := TRUE;
bDelete: BOOL;
pArrayBytes : POINTER TO BYTE;
pArrayDuts : POINTER TO BYTE;
test: INT;
parr : POINTER TO BYTE;
END_VAR
IF (bInit) THEN
pArrayBytes := __NEW(BYTE, 25);
bInit := FALSE;
END_IF
IF (pArrayBytes <> 0) THEN
pArrayBytes[24] := 125;
test := pArrayBytes[24];
END_IF
IF (bDelete) THEN
__DELETE(pArrayBytes);
END_IF

__QUERYINTERFACE
This operator is not prescribed by the IEC 61131-3 standard.
At runtime __QUERYINTERFACE is enabling a type conversion of an interface reference
to another. The operator returns a result with type BOOL. TRUE implies, that the
conversion is successfully executed.

Note: For compatibility reasons the definition of the reference to be converted must
be an extension of the base interface __SYSTEM.IQueryInterface and the compiler
version must be >= 3.3.0.20.

Advertising