I'd like to store an address of a local function in a variable, and call 
that local function, but I don't know how to define a variable of 
type "local function". Here's the error I'm stuck on, with sample code:

Error: Incompatible types:
got "<address of local function(AnsiString):Boolean;Register>"
expected "<procedure variable type of 
function(AnsiString):Boolean;Register>"


procedure test;

   function func_a (pass_str : ansistring) : boolean;
      begin
         writeln (pass_str, 'A');
         func_a := true;
      end;

   function func_b (pass_str : ansistring) : boolean;
      begin
         writeln (pass_str, 'B');
         func_b := false;
      end;

   var
      // what should this be??
      my_func : function (pass_str : ansistring) : boolean;

   begin
      my_func := @func_a;
      my_func('hello, ');
   end;

Thanks!
~David.

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

Reply via email to