Hi,
Some of my programs were last compiled with FPC 2.6.4, and there I used Corba-style Interfaces without a problem. I've now recompiled those projects with FPC 3.0.4 and the program immediately crashes.
Debugging I found that I was trying to use a interface reference, but forgot to check if it was nil or not. I've fixed the code, but the issue is still not resolved. The class in question DOES implement the interface, but FPC 3.x always returns nil, whereas FPC 2.6.4 correctly returns a Interface reference.
The class hierarchy is as follows...
TBaseApplication = class(TObject, ICmdLineParams);
|
TX11Application = class(TBaseApplication)
|
TfpgApplication = class(TX11Application)In my applications I only work with a TfpgApplication instance. If the interface is fully implemented in TBaseApplication, why does FPC 3.x _always_ report that TfpgApplication doesn't support the ICmdLineParams?
My code looks as follows:
var
cmd: ICmdLineParams;
begin
if Supports(fpgApplication, ICmdLineParams, cmd) then
begin
if cmd.HasOption('n', 'newinstance') then
MainProc
else if not AnotherInstance then
MainProc;
end
else
begin
// ICmdLineParams interface is not supported
end;I looked at the wiki and the FPC 3.x "User Changes" pages and the only reference to Interface changes is this.
http://wiki.freepascal.org/User_Changes_3.0.0#Classes_implementing_forward-declared_interfaces
The wiki is very vague with what it means. Either way, I don't consider my code wrong. I'm using a class hierarchy and the base class does implement the Interface in question fully, so why does FPC 3.x think it doesn't? Bottom line, is this a FPC bug and how to I change my code to work until the bug can be fixed?
Regards,
Graeme
