This basic sample project is for peer review of the ECOM specification. It was made in Delphi 2007 but should work with any version of Delphi that supports COM (I think Version 3 and higher). You can download it here.

Here is the listing for ECOM client sample:
[pascal]program ECOMClient;

{$APPTYPE CONSOLE}

uses
SysUtils,
cliTypes,
cliSystem;

type
TTest = class(TPyroObject)
public
constructor Create; override;
destructor Destroy; override;
procedure OnVisit(aSender: TPyroObject; aEventId: Integer; var aDone: Boolean); override;
end;

TTest2 = class(TTest)
public
constructor Create; override;
destructor Destroy; override;
procedure OnVisit(aSender: TPyroObject; aEventId: Integer; var aDone: Boolean); override;
end;

TTest3 = class(TTest)
end;

TTest4 = class(TTest)
end;


constructor TTest.Create;
begin
inherited;
end;

destructor TTest.Destroy;
begin
inherited;
end;

procedure TTest.OnVisit(aSender: TPyroObject; aEventId: Integer; var aDone: Boolean);
begin
WriteLn('TTest.OnVisit --> ', Self.ClassName);
end;

constructor TTest2.Create;
begin
inherited;
end;

destructor TTest2.Destroy;
begin
inherited;
end;

procedure TTest2.OnVisit(aSender: TPyroObject; aEventId: Integer; var aDone: Boolean);
begin
WriteLn('TTest2.OnVisit --> ', Self.ClassName);
end;


procedure test1;
var
l: TPyroObjectList;
done: boolean;
begin
l := TPyroObjectList.Create;
l.Add(TTest.Create);
l.Add(TTest2.Create);
l.Add(TTest2.Create);
l.Add(TTest3.Create);
l.Add(TTest4.Create);
done := false;
l.ForEach(l, -1, 0, done);
l.Free;
Write('Press ENTER to continue...'); ReadLn;
end;

begin
test1;
end.[/pascal]

Although very basic this sample demonstrates how ECOM solves the fundamental problems the specification has been created to do:

1. The code for TPyroObject and TPyroObjectList resides inside the DLL. You are able to declare and use an instance of this class on the client side.

2. TTestXXX are extended versions of TPyroObject. You are able to create instances of them and use like you would expect.

3. The OnVisit event handler is called from the DLL side and is able to call into the extended versions of the classes as you would expect.

4. The class instances added and managed by to the linked list will be destroyed automatically on both side just as you would expect.

Apart from the small amount of manual upfront work to code to the ECOM specs, everything should "look and feel" normal. I'm very interested in your feedback.

Thanks.