mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-29 03:53:39 +02:00

"reference to ...; cdecl;". The "reference to ..." syntax is what Delphi uses for anonymous function references. The "cdecl;" indicates that this is for the C-variant of such references, which is what blocks are git-svn-id: branches/blocks@28233 -
32 lines
344 B
ObjectPascal
32 lines
344 B
ObjectPascal
{ %target=darwin,iphonesim}
|
|
|
|
{$modeswitch blocks}
|
|
|
|
type
|
|
tblock = reference to procedure; cdecl;
|
|
|
|
procedure test(b: tblock);
|
|
begin
|
|
b;
|
|
end;
|
|
|
|
procedure proc;
|
|
begin
|
|
writeln('called as block');
|
|
end;
|
|
|
|
const
|
|
bconst: tblock = @proc;
|
|
|
|
var
|
|
b: tblock;
|
|
begin
|
|
b:=@proc;
|
|
b;
|
|
test(@proc);
|
|
test(b);
|
|
bconst;
|
|
test(bconst);
|
|
end.
|
|
|