[fpc-devel] {$Interfaces Corba} and TInterfacedObject

Marc Weustink marc.weustink at cuperus.nl
Thu Nov 29 14:22:00 CET 2007


Graeme Geldenhuys wrote:
> On 29/11/2007, Marc Weustink <marc.weustink at cuperus.nl> wrote:
> 
>> http://www.freepascal.org/mantis/view.php?id=6798
> 
> 
> I can confirm that this doesn't work....
> 
> {$Interfaces Corba}
> 
> var
>   cmd: ICommand;
>   holder: ICommandHolder;
>   ins: TAddCommand;
> begin
>   ins := TAddCommand.Create(memName1);
>   ins.GetInterface(ICommand, cmd);
>   if cmd <> nil then
>   begin
>     writeln('It worked');
>     cmd.Execute;
>   end;
>  ins.free;
> end;
> 
> 
> "it worked" never gets printed.

Yes, you cannot query corba objects, since they don't have a 
QueryInterface method.

However cmd := ins; should work.

Marc

PS.

IMO borland screwed up here when they introduced IInterface = IUnknown.
It was IMo cleaner (and you can mix interface types) when they declared 
it like:

type
   IInterface = interface
   end;

   IUnknown = interface(IInterface)
     _addref...
     _release....
     Query....
   end;





More information about the fpc-devel mailing list