[fpc-devel] functions within record declarations

Tomas Hajny XHajT03 at mbox.vol.cz
Mon Dec 5 17:54:29 CET 2005


Christopher Cureau wrote:


Hi,

> I've been trying to compile some code that used to work in version 1.0.10
> of the compiler, but now seems to give errors.  In each of the errors
> below, it looks like a function is being put into a record, and the
> compiler doesn't like it.  I have pasted the relevant lines from fs.inc
> below along with the errors that the compiler throws.
>
> Can anyone shed some light onto what has changed between compiler
> versions?
>
> Thanks,
> Chris Cureau
>
> code: (line number prefixes...)
>
> 103:   file_system_type = record
> 104:     name       : string[20];
> 105:      fs_flag    : dword;
> 106:      read_super : function (sb : P_super_block_t) : P_super_block_t;
> 107:      next       : ^file_system_type;
> 108:   end;

First, it's easier if you provide a directly compilable example. Second,
changing your type declaration as shown below should make it to compile.


type
  P_Super_block_t = pointer;

  Pfile_system_type = ^file_system_type
  file_system_type = record
    name       : string[20];
    fs_flag    : dword;
    read_super : function (sb : P_super_block_t) : P_super_block_t;
    next       : Pfile_system_type;
  end;

begin
end.

Tomas




More information about the fpc-devel mailing list