Am 28.06.2012 15:23 schrieb "Bernd" <prof7...@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
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal