> On Nov 11, 2016, at 5:52 PM, Tony Whyman <tony.why...@mccallumwhyman.com> > wrote: > > Someone else may correct me, but with CORBA, I believe you have to explicitly > add a function to the interface such as > > function GetObject: TMyObject; > > and implement as > > function TMyObject.GetObject: TMyObject; > begin > Result := self; > end;
I think I’m out of time now but I’ll try this in my code that was crashing before. How is this different from just casting the interface to an object? There’s your example below basically like I was doing it before with the seemingly random crashes. Isn’t MyObject2 still pointing to MyObject1? type IMyInterface = interface procedure MyProc; end; TMyObjectClass = class(TInterfacedObject,IMyInterface) public procedure MyProc; end; var MyObject1, MyObject2: TMyObjectClass; MyInterface: IMyInterface; begin MyObject1 := TMyObjectClass.Create; MyInterface := MyObject1; MyInterface.MyProc; MyObject2 := TMyObjectClass(MyInterface); MyObject1.Free {OK for CORBA - will cause an exception in COM} {MyObject1, MyObject2 and MyInterface are now all invalid} end; Regards, Ryan Joseph _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal