Given the code below, wich is a very trimmed down version of the actual code, I get the following error:
[DCC Error] Unit3.pas(31): E2010 Incompatible types: \'IXL
With three minor modification (IInterface, FindAll with "S: class" [Thanks Mason] and the typecasts in FindAll) I got it compiling.
Full code:
unit Unit16;
interface
uses
Generics.Collections;
type
IXList = interface
end;
TXList = class(TList, IInterface, IXList)
protected
FRefCount: Integer;
function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
function _AddRef: Integer; stdcall;
function _Release: Integer; stdcall;
public
function Find: IXList;
function FindAll: IXList;
end;
implementation
uses Windows;
function TXList.Find: IXList;
begin
Result := TXList.Create;
end;
function TXList.FindAll: IXList;
begin
Result := IXList(IUnknown(TXList.Create));
end;
function TXList.QueryInterface(const IID: TGUID; out Obj): HResult;
begin
Result := E_NoInterface;
end;
function TXList._AddRef: Integer;
begin
InterlockedIncrement(FRefCount);
end;
function TXList._Release: Integer;
begin
InterlockedDecrement(FRefCount);
if FRefCount = 0 then Self.Destroy;
end;
end.