[fpc-devel] Using Macros for IInterface

Marco van de Voort marcov at stack.nl
Wed Sep 26 13:43:24 CEST 2012

In our previous episode, Graeme Geldenhuys said:
> >
> > It means the interface will always be constref, and thus no ifdefing in FPC
> > (if you don't support <2.6.0) will be necessary.
> For fpGUI, I only support the latest stable release of FPC, so that 
> would be 2.6.0. So I should be fine with removing that IFDEF then.

Yes, but for that you don't depend on FPC to do or merge anything. The
removing of the ifdef is only FPC internal cleanup.
> > But users don't need to ifdef if they don't use compilers that
> > don't support constref (FPC 2.4 series and delphi)
> Umm, so here might be a problem. tiOPF is a shared code base between FPC 
> and Delphi. 

Yeah, why do you think I mentioned it? :-)

> Does the compiler mode (we use mode delphi in tiOPF) not affect the
> constref? 

Not that I know, or any other directive. IIRC it was argued that those
methods were more implementation oriented (iow a bit internal), and that one
ifdef doesn't matter much.

> After all, it seems Delphi doesn't have a constref correct? 

I don't know what XE3 improves in that regard. But since FPC encountered
this problem only after going multiarchitecture, I don't expect Embarcadero
to deal with that until the new Delphi compiler lands. 

> Or would this mean that in fpGUI my IInterface usage can always be 
> constref - because fpGUI only supports FPC and only v2.6.0.


> And in tiOPF the IInterface usage can always be const, because Delphi 
> doesn't support constref, and we use mode delphi?

No. There you will have to keep the ifdef till Embarcadero catches up.

More information about the fpc-devel mailing list