System.Rtti.TRawVirtualClass.FindInterface

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function FindInterface(IID: TGUID): Pointer;

C++

void * __fastcall FindInterface(const GUID &IID);

Properties

Type Visibility Source Unit Parent
function public
System.Rtti.pas
System.Rtti.hpp
System.Rtti TRawVirtualClass

Description

Finds and returns the interface pointer for the given GUID.

FindInterface returns only pointers to interfaces that are actual virtual interfaces added to this class. It does not follow the full semantics of QueryInterface, in which there is a delegate to inherited versions if you do not find the interface locally. This interface is very special because it returns the raw pointer of the interface, without calling AddRef on the interface. It is a very special case operation that is useful only in extreme edge cases. Because the pointer is not AddRefed, you must be extremely careful with how you use the result, lest you inadvertently cause an object to be freed.

FindInterface returns nil if the interface cannot be found locally.

See Also