unit uCountObj;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses
  Windows, ActiveX, Classes, ComObj, PCountDemo_TLB, StdVcl;

type
  TCountObjDemo = class(TTypedComObject, ICountObjDemo)
  private
    igCounter : Integer;
  protected
    function CountMe(var iCount: Integer): HResult; stdcall;
    {Declare ICountObjDemo methods here}
  end;

implementation

uses ComServ;

function TCountObjDemo.CountMe(var iCount: Integer): HResult;
begin
  iCount := InterlockedIncrement(igCounter);
  Result := S_OK;
end;

initialization
  TTypedComObjectFactory.Create(ComServer, TCountObjDemo, Class_CountObjDemo,
    ciMultiInstance, tmBoth);
end.
