Skip to content

Commit 597d689

Browse files
committed
266: Error when calling delphi function in x64 mode
1 parent 3bf2b93 commit 597d689

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

Source/uPSRuntime.pas

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10476,6 +10476,7 @@ function ClassCallProcMethod(Caller: TPSExec; p: TPSExternalProcRec; Global, Sta
1047610476
CurrStack: Cardinal;
1047710477
cc: TPSCallingConvention;
1047810478
s: tbtString;
10479+
dx: Integer;
1047910480
begin
1048010481
s := p.Decl;
1048110482
if length(S) < 2 then
@@ -10499,16 +10500,21 @@ function ClassCallProcMethod(Caller: TPSExec; p: TPSExternalProcRec; Global, Sta
1049910500
CurrStack := Cardinal(Stack.Count) - Cardinal(length(s)) -1;
1050010501
if s[1] = #0 then inc(CurrStack);
1050110502
MyList := TPSList.Create;
10502-
if p.Ext2 = nil then
10503+
{$IFDEF CPUX64}
10504+
if p.Ext2 = nil then begin
1050310505
MyList.Add(NewPPSVariantIFC(n, False));
10506+
FSelf := nil;
10507+
end;
10508+
{$ENDIF}
10509+
dx := MyList.Count;
1050410510
for i := 2 to length(s) do
1050510511
begin
1050610512
MyList.Add(nil);
1050710513
end;
1050810514
for i := length(s) downto 2 do
1050910515
begin
1051010516
n := Stack[CurrStack];
10511-
MyList[i - 2] := NewPPSVariantIFC(n, s[i] <> #0);
10517+
MyList[i - 2 + dx] := NewPPSVariantIFC(n, s[i] <> #0);
1051210518
inc(CurrStack);
1051310519
end;
1051410520
if s[1] <> #0 then
@@ -10517,7 +10523,7 @@ function ClassCallProcMethod(Caller: TPSExec; p: TPSExternalProcRec; Global, Sta
1051710523
end else v := nil;
1051810524
try
1051910525
if p.Ext2 = nil then
10520-
Result := Caller.InnerfuseCall(nil, p.Ext1, cc, MyList, v)
10526+
Result := Caller.InnerfuseCall(FSelf, p.Ext1, cc, MyList, v)
1052110527
else
1052210528
Result := Caller.InnerfuseCall(FSelf, VirtualMethodPtrToPtr(p.Ext1, FSelf), cc, MyList, v);
1052310529
finally
@@ -11093,14 +11099,13 @@ function ClassCallProcPropertyHelper(Caller: TPSExec; p: TPSExternalProcRec; Glo
1109311099
exit;
1109411100
end;
1109511101
Params := TPSList.Create;
11096-
Params.Add(NewPPSVariantIFC(Stack[Longint(Stack.Count) - 2], False));
1109711102
Params.Add(NewPPSVariantIFC(Stack[Longint(Stack.Count) - 1], True));
1109811103
for i := Stack.Count -3 downto Longint(Stack.Count) - ParamCount -2 do
1109911104
begin
1110011105
Params.Add(NewPPSVariantIFC(Stack[I], False));
1110111106
end;
1110211107
try
11103-
Result := Caller.InnerfuseCall(nil, p.Ext1, cdRegister, Params, nil);
11108+
Result := Caller.InnerfuseCall(FSelf, p.Ext1, cdRegister, Params, nil);
1110411109
finally
1110511110
DisposePPSVariantIFCList(Params);
1110611111
end;
@@ -11120,15 +11125,14 @@ function ClassCallProcPropertyHelper(Caller: TPSExec; p: TPSExternalProcRec; Glo
1112011125
exit;
1112111126
end;
1112211127
Params := TPSList.Create;
11123-
Params.Add(NewPPSVariantIFC(Stack[Longint(Stack.Count) - 1], False));
1112411128
Params.Add(NewPPSVariantIFC(Stack[Longint(Stack.Count) - ParamCount - 2], False));
1112511129

1112611130
for i := Stack.Count -2 downto Longint(Stack.Count) - ParamCount -1 do
1112711131
begin
1112811132
Params.Add(NewPPSVariantIFC(Stack[I], False));
1112911133
end;
1113011134
try
11131-
Result := Caller.InnerfuseCall(nil, p.Ext2, cdregister, Params, nil);
11135+
Result := Caller.InnerfuseCall(FSelf, p.Ext2, cdregister, Params, nil);
1113211136
finally
1113311137
DisposePPSVariantIFCList(Params);
1113411138
end;

0 commit comments

Comments
 (0)