[Lazarus] IUnknown and reference counting

Marco van de Voort marcov at stack.nl
Mon Mar 25 11:05:51 CET 2013


On Thu, Mar 21, 2013 at 08:26:21AM +0000, Graeme Geldenhuys wrote:
> 
> Correct. And as Martin said, the name "CORBA" is a bit misleading. FPC
> has no CORBA or ORB implementation, so no distributed communications can
> be done out of the box.

(Well, there is DCOM of course)

> The interfaces in that mode [CORBA style], I
> guess, is just _similar_ to real CORBA apps. The easiest way to explain
> it is that CORBA style interfaces are just like COM style interfaces,
> but without reference counting, and no IUnknown methods.

Corba ORB interfaces ARE reference counted. (using incref and decref methods
iirc).

The difference was that in Corba it was custom to handle this manually,
since keeping references long than necessary meant that the Corba server had
to keep the object instance in memory.

But I agree that the name was horribly, horribly chosen. Basically what
happened is that there was whining about how windows dependent the IUnknown
scheme was, when it was implemented, somebody mentioned Corba as non-Windows
possibility.  The usual anti Delphi/Windows chorus in the maillist caught
on, and suddenly all non-IUnknown interfaces were Corba :-)


The reference counting is purely done for COM purposes, not for direct
memory safety collection. Note that all other ref counted types in Delphi
can't cause cycles. Interfaces can.





More information about the Lazarus mailing list