[Lazarus] IUnknown and reference counting

Hans-Peter Diettrich DrDiettrich1 at aol.com
Thu Mar 21 21:48:28 CET 2013


Sven Barth schrieb:
> On 21.03.2013 21:14, Hans-Peter Diettrich wrote:
>> Sven Barth schrieb:
>>
>>>  > Thanks for giving me insight into the crippled implementation of
>>> interfaces in FPC :-]
>>>
>>> Why crippled?
>>
>> When FPC does not allow to use delegation ("implements") together with
>> implementing selected methods, this feature is of no practical use :-(
> 
> There exists at least a bug report about it: 
> http://bugs.freepascal.org/view.php?id=16531 :)

+1

>> Also the hype about CORBA interfaces looks like mere eye-candy or
>> obfuscation to me. Delphi interfaces require neither COM nor CORBA, they
>> are only open in either direction.
> 
> But some people don't like the reference counting. They want to use 
> interfaces like in other languages to just define a "interface" to a class.

Since reference counting must be implemented, it also can be implemented 
as *not* counting references. Similar to AnsiString constants, which 
also live forever. A simple _AddRef after creation of an interfaced 
object achieves almost the same effect.

DoDi




More information about the Lazarus mailing list