[fpc-pascal]interfaces in FPC.

vkrish at vkrish.cjb.net vkrish at vkrish.cjb.net
Tue Jan 7 19:11:07 CET 2003

> I personally would recommend to use IUnknown, as it is a semi-standard 
> by now. It adds only 3 methods for reference counting and typecasting 
> support, and not only COM uses it. (e.g. Mozilla's internal components 
> use IUnknown compatible interfaces as well)
I'm confused. 

1.I want to use interfaces as a language construct within a single application/library. I don't want to build components that are managed across applications. In that case, why do I need AddRef and friends ? 

2. I can't directly instantiate an interface - this is not the case with COM/XpCOM components which are instantiated directly and hence need ref. counting.

3. Consider an example interface for traversing a collection:

type IIterator = interface
  function HasNext:boolean;
  function Item:TObject;

Now what has reference counting to do with this interface ?


More information about the fpc-pascal mailing list