tblock1a.pp 356 B

1234567891011121314151617181920212223242526272829303132
  1. { %target=darwin,iphonesim}
  2. {$mode delphi}
  3. {$modeswitch blocks}
  4. type
  5. tblock = reference to procedure; cdecl;
  6. procedure test(b: tblock);
  7. begin
  8. b;
  9. end;
  10. procedure proc;
  11. begin
  12. writeln('called as block');
  13. end;
  14. const
  15. bconst: tblock = proc;
  16. var
  17. b: tblock;
  18. begin
  19. b:=proc;
  20. b;
  21. test(proc);
  22. test(b);
  23. bconst;
  24. test(bconst);
  25. end.