delphi使用函数指针调用函数第一个参数不能获取。

完整代码如下所示,定义了一个函数指针类型TFunctiontest = function (const a:integer; const b:integer; const c:integer): integer; 然后定义了一个指针变量。再定义了一个函数function functiona(const a :integer; const b:integer;const c:integer):integer;并将该函数的地址赋值给函数指针,然后通过函数指针去调用,希望得到的结果是1,2,3,但是没有得到第一个参数,求解答?

unit Unit1;

interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

TFunctiontest = function (const a:integer; const b:integer; const c:integer): integer;

var
Form1: TForm1;

implementation

{$R *.dfm}
function functiona(const a :integer; const b:integer;const c:integer):integer;
begin
showmessage(inttostr(a));
showmessage(inttostr(b));
showmessage(inttostr(c));
end;

procedure TForm1.Button1Click(Sender: TObject);
var
pf : TFunctiontest;
const a:integer =1;
const b:integer =2;
const c:integer =3;
begin
pf := @functiona;
pf(a,b,c);
end;

end.

这个没有问题啊,我执行过的。从代码上看不出什么问题

下一个断点调试下呢?是不是因为用了fastcall

问题解决了,在参数定义前加 var 就解决了,但是不知道为什么? 有谁可以告诉我为什么吗?