On Monday 19 September 2011 15.55:57 Marcos Douglas wrote:
> On Mon, Sep 19, 2011 at 10:49 AM, Martin Schreiber <mse00...@gmail.com> 
wrote:
> > > Here is my doubt: I can use variables additionally to the instance
> > > variable -- that is one of advantages, the parameters of some methods
> > > will be interfaces -- but I can not instantiate an interface variable,
> > > because I can't release it. Is that right?
> > 
> > You can add addref()/release() methods to your CORBA interface and do
> > refcounting in the implementing class if necessary.
> 
> I understood, but that case is the same that TInterfacedObject, isn't?
> 
TInterfacedObject with COM interface _Addref()/_Release uses compiler magic 
which is more magic in FPC (intermediate variables) than in Delphi. ;-)
With CORBA interface and explicitly calling Addref()/Release() there is better 
control to define the destroying event.

> > > Resume:
> > > 1- In CORBA, I only can instantiate variables of concret class, but I
> > > can use interfaces variables additionally to the instance variable, of
> > > course;
> > 
> > Correct.
> > 
> > > 2- In IUnknow, I only can instantiate variables of interfaces.
> > 
> > In FPC correct. In Delphi it is usually possible to use COM interfaces
> > with not ref counted object instances for example with TComponent.
> 
> You're right.
> So, if my code will have compatibility with Delphi, is better to use
> CORBA interfaces and no reference counted if I compile it on Delhi. Is
> this the best way?
> 
So it is done in MSEgui. Or use COM interfaces and *never* explicitly destroy 
an implementing object instance. BTW newer Delphi have CORBA interfaces too 
AFAIK.

Martin
_______________________________________________
MSEide-MSEgui-talk mailing list
MSEide-MSEgui-talk@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/mseide-msegui-talk

Reply via email to