[fpc-pascal] record helper types in 2.6
Sven Barth
pascaldragon at googlemail.com
Thu Jun 28 17:23:23 CEST 2012
Am 28.06.2012 15:23 schrieb "Bernd" <prof7bit at gmail.com>:
>
> hello, I am referring to this: http://wiki.freepascal.org/Helper_types
>
> I am using 2.6.1 from the fixes branch, last updated no longer than a
week ago.
>
> the wiki mentions this syntax:
>
> TTestHelper = record helper for TTest
> procedure SomeMethod;
> end;
>
> Now I must be understanding something completely wrong or doing
> something incredibly stupid but I can't find it, do I have to enable
> some mode switch for record helpers to work or is there something else
> that prevents my code from compiling? I am trying to do the following:
>
>
>
> unit purple;
>
> {$mode objfpc}{$H+}
> {$if FPC_FULLVERSION < 20600}
> {$fatal *** You need Free Pascal Compiler version 2.6.0 or higher *** }
> {$endif}
>
> interface
> uses
> Classes,
> ctypes,
> glib2;
>
> type
> TGListHelper = record helper for TGList
> function Append(Item: Pointer): Pointer;
> end;
>
> and it will generate the following error:
> libpurple/purple.pas(77,32) Fatal: Syntax error, ":" expected but "FOR"
found
>
> I have stripped down the example to the bare minimum, so the line
> numbers do not match but in the original file (77,32) points to the
> "for" in the first line of the type declaration. What is wrong?
Ops... seems that I have forgotten to mention this: in non-Delphi modes you
need to enable the "advancedrecords" modeswitch to be able to declare
record helpers.
Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20120628/d64b5445/attachment.html>
More information about the fpc-pascal
mailing list