IUnknown::Release

Windows CE .NET

This method decrements the reference count for the calling interface on a object. If the reference count on the object falls to zero, the object is freed from memory.

ULONG Release(void);

Parameters

None.

Return Values

Returns the resulting value of the reference count, which is used for diagnostic/testing purposes only. If you need to know that resources have been freed, use an interface with higher-level semantics.

Remarks

If the IUnknown::AddRef method has been called on this object's interface n times and this is the n+1 call to IUnknown::Release, the implementation of IUnknown::AddRef must cause the interface pointer to free itself. When the released pointer is the only existing reference to an object (whether the object supports single or multiple interfaces), the implementation must free the object.

Aggregation of objects restricts the ability to recover interface pointers.

To determine whether the platform supports this interface, see Determining Supported COM APIs.

Notes to Callers

Call this method when you no longer need to use an interface pointer. If you are writing a function that takes an in-out parameter, call IUnknown::Release on the pointer you are passing in before copying the out-value on top of it.

Requirements

OS Versions: Windows CE 1.0 and later.
Header: Unknwn.h, Unknwn.idl.
Link Library: Ole32.lib, Uuid.lib.

See Also

IUnknown::AddRef


Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.

Show: