Interfaces works in FPC 2.6.4 but not in 3.0.2

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Interfaces works in FPC 2.6.4 but not in 3.0.2

Graeme Geldenhuys-6
Hi,

I have CORBA style interfaces. My projects using them work perfectly in
FPC 2.6.4, but if I compile the project with FPC 3.0.2, I never get
a interface reference.

My class hierarchy is as follows:

  {$interfaces corba}

  ICmdLineParams = interface
    ['{EDF51E67-1119-11E6-B131-C86000E37EB0}']
    ...
  end;

  TfpgCmdLineParams = class(TObject, ICmdLineParams)
    ...
  end;

  TfpgApplicationBase = class(TfpgComponent, ICmdLineParams)
  private
    FCmdLineParams: TfpgCmdLineParams;
    property CmdLineParams: TfpgCmdLineParams read FCmdLineParams implements ICmdLineParams;
  end;

  TfpgApplication = class(TfpgApplicationBase)
    ...
  end;


Then the usage in my application:

var
  cmd: ICmdLineParams;
begin
  if Supports(fpgApplication, ICmdLineParams, cmd) then  // <<<< Never works
  begin
    ...
  end;
end.


fpgApplication is a global instance of TfpgApplication.

The line marked with "Never works" never works with FPC 3.0.2, but
it does with FPC 2.6.4.

Can anybody explain this?


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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Interfaces works in FPC 2.6.4 but not in 3.0.2

Marcos Douglas B. Santos
On Sat, May 6, 2017 at 7:37 PM, Graeme Geldenhuys
<[hidden email]> wrote:

> var
>   cmd: ICmdLineParams;
> begin
>   if Supports(fpgApplication, ICmdLineParams, cmd) then  // <<<< Never works
>   begin
>     ...
>   end;
> end.
>
>
> fpgApplication is a global instance of TfpgApplication.
>
> The line marked with "Never works" never works with FPC 3.0.2, but
> it does with FPC 2.6.4.
>
> Can anybody explain this?

The same here. It did not work neither CORBA nor COM.
I've tried to use the property as public too, but did not work either.

I use delegation by properties a lot, but this haven't broke my code
because I do not use inheritance... but definally this is a bug.

Best regards,
Marcos Douglas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal