FW_SafeRelease

FW_SafeRelease 1:

This function decrements the reference counter of the object, analogous to ITcUnknown.TcRelease(), and at the same time sets the interface pointer to zero.

FW_SafeRelease 2: Return value

FW_SafeRelease : HRESULT;

Name

Type

Description

FW_SafeRelease

HRESULT

Returns S_OK if the function call was successful.

FW_SafeRelease 3: Inputs

VAR_INPUT
    pipUnk : POINTER TO ITcUknown;
END_VAR

Name

Type

Description

pipUnk 

POINTER TO ITcUknown

Specifies the address of the interface pointer to the object. The interface pointer is checked internally for null pointers.

Example

This function can for example be called in the destructor of the object family, which holds an interface pointer to another object.

METHOD FB_exit : BOOL
VAR_INPUT
    bInCopyCode : BOOL; // if TRUE, the exit method is called for exiting an instance that is copied afterwards (online change).
END_VAR
-----------------------------------------------------------------------
IF NOT bInCopyCode THEN // no online change
    FW_SafeRelease(ADR(ipItf));
END_IF

Requirements

TwinCAT Version

Hardware

Libraries to be integrated

TwinCAT 3.1, Build 4020

x86, x64, ARM

Tc3_Module