[fpc-pascal] Class procedure assigned to object's event

Antonio Sanguigni a.sanguigni at gmail.com
Tue May 26 16:15:06 CEST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Graeme Geldenhuys wrote:
 > You need to assign the address of that method in objfpc mode using
the @ syntax.
> 
>     FTP.OnStatus:=callback. at StatusCMD
> or was it...
>     FTP.OnStatus:=@callback.StatusCMD
> 
> Something like that. I can never remember which. ;-)

Well I already tried it. For the first one I got:
main.pas(261,28) Fatal: Syntax error, "identifier" expected but "@" found

For the second one:
main.pas(261,19) Error: Incompatible types: got "<class method type of
procedure(TObject, Boolean,const AnsiString) of object;Register>"
expected "<procedure variable type of procedure(TObject, Boolean,const
AnsiString) of object;Register>"

> I prefer objfpc mode as it's a lot stricter than delphi mode. But if

Me too ;).

> you work on shared code projects that must compile under Delphi and
> FPC, it is just easier (and cleaner) to use delphi mode. Otherwise you
> sit with a lot of {$IFDEF FPC} entries.

Oh yes, that's not a problem. Just setting delphi mode is ok for me. I
was curios to better understand fpc behaviour.

Thanks
Antonio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkob+WoACgkQYSsm1R1/E7wBMgCfdXAtfgTvWNFsxPZXbAwjqCSi
DPYAoONBGI0Htpnj/+gPkXEX20H3vvYb
=H7dQ
-----END PGP SIGNATURE-----



More information about the fpc-pascal mailing list