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

F_CmpLibVersion 2: Inputs

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

Name

Type

Description

stVersion

ST_LibVersion

Version of the existing library (type: ST_LibVersion)

iMajor

UINT

Required major number

iMinor

UINT

Required minor number

iBuild

UINT

Required build number

iRevision

UINT

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)