[lazarus] Remove interface class?

Micha Nelissen micha at neli.hopto.org
Thu Dec 18 04:51:06 EST 2003


Vincent Snijders wrote:

> On Thu, 18 Dec 2003 10:00:07 +0100
> Micha Nelissen <micha at neli.hopto.org> wrote:
> 
> 
>>Hi,
>>
>>As the code is, currently, we can remove the interface class. The
>>global interface functions will stay and be pointers and the
>>interfacebase will implement them as it does now. The platform
>>interfaces can rewrite the functions as needed, and the private
>>variables can be global variables private to the unit (as there is
>>only one instance of the interface class). 
> 
> What do you mean by interface class: the TGTKObject and TWin32Object
> classes?
> What are the global interface functions?

LclIntf.pas using winapih.inc without defining IF_BASE_MEMBER.

>>Advantages:
>>
>>1) possibly remove IF_BASE_MEMBER stuff because only one global 
>>declaration of each interface function
> 
> That is why we have an api wizard.

Using include files twice in this way is not very nice, if you ask me.

>>2) speedup and code reduction, because the self pointer doesn't have
>>to be passed anymore.
> 
> I think these are minor issues. I don't think it speeds up very much.
> But I haven't done any profiling.

More code reduction than speed actually. The global 'stubs' can be 
removed, and the compiler doesn't have to generate code for pusing the 
'self' parameter. Not much each call, but there are quite some calls. As 
the lcl is very big, we should strive for code reduction where possible, 
IMHO.

Micha.







More information about the Lazarus mailing list