F_CmpLibVersion

F_CmpLibVersion 1:

The function F_CmpLibVersion compares the version of the existing library with the required version. Each library has its own version information as a constant of type: ST_LibVersion. The name of the constant has the format: stLibVersion_libraryname.

FUNCTION F_CmpLibVersion: DINT

VAR_INPUT
    stVersion   : ST_LibVersion;
    iMajor      : UINT;
    iMinor      : UINT;
    iBuild      : UINT;
    iRevision   : UINT;
END_VAR

stVersion: Version of the existing library (type: ST_LibVersion).

iMajor: Required major number.

iMinor: Required minor number.

iBuild: Required build number.

iRevision: Required revision number.

Return parameter

Version relationship

-1

Your version is lower than the required version

0

Your version is the required version

+1

Your version is higher than then required version

Example in ST:

IF F_CmpLibVersion( stLibVersion_Tc2_System, 3, 3, 8, 0) >= 0 THEN
    (* newer lib ...*)
ELSE
    (* older lib... *)
END_IF

Requirements

Development environment

Target system type

PLC libraries to include (Category group)

TwinCAT v3.1.0

PC or CX (x86, x64, ARM)

Tc2_System (System)