System.IInterface._AddRef

From RAD Studio API Documentation
Jump to: navigation, search


Delphi

function _AddRef: Integer; stdcall;

Properties

Type Visibility Source Unit Parent
function public System.pas System IInterface

Description

Increments the reference count for this interface.

The Delphi compiler automatically generates a call to _AddRef for every reference to this interface. For most implementations, _AddRef increments the reference count for the interface and returns the new reference count. When the caller is through with the interface, the compiler generates a call to the _Release method, which decrements the reference count. When the reference count drops to zero, the object is automatically freed.

Note: Implementation objects can implement _AddRef and _Release so that they do not perform any reference counting. For such objects, the reference count never drops to zero and the object is not automatically freed. In these cases, it is the application's responsibility to free the object.

See Also