opensubscriber
   Find in this group all groups
 
Unknown more information…

f : fpc-pascal@lists.freepascal.org 28 June 2012 • 9:11PM -0400

[fpc-pascal] record helper types in 2.6
by Bernd

REPLY TO AUTHOR
 
REPLY TO GROUP




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?

Bernd
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@list...
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.