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

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Sat Nov 4 00:52:41 CET 2017


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.

Sample output:


=======[ compiled with FPC 3.0.0, 3.0.2, 3.0.4 and 3.1.1]============
[tmp]$ ./project1
TClassA: ICmdLine interface is not supported!
TClassB: ICmdLine interface is not supported!
TClassC: ICmdLine interface is not supported!


=======[ compiled with FPC 2.6.4]============
[tmp]$ ./project1
TCmdLineImpl: ICmdLine.MyProc implementation
TCmdLineImpl: ICmdLine.MyProc implementation
TCmdLineImpl: ICmdLine.MyProc implementation



I did some further testing. In the attached project I have a dedicated 
class that implements the interface, then another class that implements 
the interface using interface delegation.  If I change the sample code 
and NOT use interface delegation, but let TClassA directly implement the 
ICmdLine interface, then everything works.

But developers shouldn't need to be forced to do this. FPC support 
interface delegation and the real interface is a lot more complex to 
implement than the very simplified attached example. The nail in the 
coffin is that it used to work in FPC 2.6.4, but is now broken in FPC 3.x


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: project1.lpr
Type: text/typhon-project-source
Size: 1848 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20171103/43f3fd1b/attachment.bin>


More information about the fpc-pascal mailing list