unit Unit2;

interface

uses
  ComObj, ActiveX, Apollo_TLB, StdVcl;

type
  TPhi = class(TAutoObject, IPhi)
  protected
    procedure Load(const script: WideString); safecall;
    function Alive: OleVariant; safecall;
  end;

implementation

uses
  ComServ,
{$IFDEF PHIEMBED}
  PhiMainUnit;
{$ELSE}
  Pythia;
{$ENDIF}

procedure TPhi.Load(const script: WideString);
begin
  PhiLoadProtect(PChar(string(script)), nil);
end;

function TPhi.Alive: OleVariant;
begin
  result := PhiAlive;
end;

initialization
  CoInitialize(nil);
  TAutoObjectFactory.Create(ComServer, TPhi, Class_Phi,
    ciMultiInstance, tmApartment);
finalization
  CoUninitialize;
end.
