function pointers - whats wrong ???

06 Feb 1997 16:02:00 +0200



hello gpc users,

I tryed to use the famous function pointers, but I can't compile this  
stuff. I tryed the example from info files - the same sh...

Look:

     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.

Output from gpc:

fupotest.pas(16) Error: to few arguments to function `Write_int'
fupotest.pas(16) Error: invalid lvalue in unary `&'


Now it's your turn ... what's wrong?


Further questions:

How I can put the stderr output in a file? I'm using DJGPP.
It's possible to speed up the standard compilation of gpc for my pentium?
What's the floating point type of gpc's complex numbers?

Anybody is using my graph unit "BGI2GRX"?
I'm working on a direct GRX20-Unit (contexts, mouse, ...) but I don't know  
if it's needed by anybody else me.

      ___,
    ((__         o
   ,____)) V E N I


Sven Hilscher (Sven@rufus.central.de (Sven Hilscher))

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es