[fpc-pascal] using Interfaces in descendant classes 2.6.4 vs 3.x

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Sat Nov 4 01:18:08 CET 2017


On 2017-11-03 23:52, Graeme Geldenhuys wrote:
> Attached is a sample application reproducing the problem. Compile the
> program with FPC 2.6.4 and everything works. Compile it with FPC 3.x and
> no interface reference is ever returned.


Yet more testing..... Now I've managed to get it to work in all FPC 
versions. Yeah!!!

If I change my class that does interface delegation to the following syntax:

    TClassA = class(TObject, ICmdLine)
    private
     FCmdLineParams: TCmdLineImpl;
     function GetCmdLineParamsInterface: TCmdLineImpl;
     property ChildDelegate: TCmdLineImpl read GetCmdLineParamsInterface 
implements ICmdLine;
    public
      destructor Destroy; override;
    end;


Then it works. Note I changed the function and property definitions.

Still strange that FPC 2.6.4 worked in my prior example and FPC 3.x not. 
I also didn't see any "User Changes" on the wiki about this changed 
behaviour of Interface Delegation.

Regards,
   Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp



More information about the fpc-pascal mailing list