Hi,
I'm trying to use signals with GPC 2.0 under Linux (binary release...).
But I have problems in assigning a function address to a pointer. I'm basing my signal routine in the 'Function pointers' example, described in the HTML documentation of GPC, but it doesn't seem to work. Here goes the example and the compilation error:
&>----------------------------------------------------------------------------<
program zap(output);
type proc_ptr = ^ procedure (integer);
var pvar : proc_ptr;
procedure write_int(i: integer); begin writeln ('Integer: ',i:1); end;
begin (* PVAR points to function WRITE_IT *) pvar := & write_int;
(* Dereferencing a function pointer calls the function *) pvar^(12345); end.
----------------------------------------------------------------------------<
And GPC output is: example.pas: In function `program_Zap': example.pas:16: too few arguments to function `Write_int' example.pas:16: invalid lvalue in unary `&'
----------------------------------------------------------------------------<
It seems that GPC is not understanding that ' & Write_int' as it should.
So , what am I doing wrong ?
thanks for any help,
Patricio.