@ALLIGATOR
Answer to
original question:
program project1;
{$ifdef fpc}
{$mode delphi}
{$modeswitch anonymousfunctions}
{$modeswitch functionreferences}
{$endif}
type
TMyProc = reference to procedure (value: NativeInt); // <<------reference----
procedure Test(const anonproc:TMyProc);
begin
anonproc(33);
end;
procedure Run;
begin
Test(procedure (value: NativeInt)
begin
WriteLn('Anon value = ', value);
end);
end;
begin
Run;
ReadLn;
end.
Small change, but that is what I meant: it should be a reference.
Btw: highly contrived code you wanted, but it works now.
This is actually another example of combining anonymous methods and function references similar to what I gave last week.