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

L-force | PLC Designer
Programming Reference
DMS 4.1 EN 03/2011 TD29
1081
PLC_PRG(PRG)
VAR
pFB : POINTER TO FBDynamic;
bInit: BOOL := TRUE;
bDelete: BOOL;
loc : INT;
END_VAR
IF (bInit) THEN
pFB := __NEW(FBDynamic);
bInit := FALSE;
END_IF
IF (pFB <> 0) THEN
pFB^(in1 := 1, in2 := loc, out => loc);
pFB^.INC();
END_IF
IF (bDelete) THEN
__DELETE(pFB);
END_IF
__ISVALIDREF
This operator is not prescribed by the IEC 61131-3 standard. It can be used to check
whether a reference points to a valid value. For how to use and an example see the
description of the reference data type.
__NEW
This operator is not prescribed by the IEC 61131-3 standard.
Note: For compatibility reasons the compiler version must be >= 3.3.2.0.
The operator __NEW allocates memory for function block instances or arrays of
standard data types. The operator returns a suitably typed, nonzero pointer to the
object. If the operator is not used within an assignment an error message will occur.
If unsuccessful, by __NEW returns 0.
For deallocating use __DELETE.