Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variant as Parametr in x64 #240

Open
Varera opened this issue Dec 21, 2020 · 0 comments
Open

Variant as Parametr in x64 #240

Varera opened this issue Dec 21, 2020 · 0 comments

Comments

@Varera
Copy link

Varera commented Dec 21, 2020

This code works fine in 32-bit mode, but in x64 the var2str_func function passes the parameter Unassigned.
A rule parameter is passed to var2str

procedure TForm26.btn1Click(Sender: TObject);
var
PSS: TPSScript;
begin
PSS := TPSScript.Create(nil);
try
PSS.OnCompile := PSSCompile;
PSS.Script.Text := 'begin var2str(12); var2str_func(13); end.';
if PSS.Compile then PSS.Execute;
finally
FreeAndNil(PSS);
end;
end;

function TForm26.var2str(AValue: Variant): string;
begin
Result := AValue;
end;

function var2str_func(const AValue: Variant): string;
begin
Result := AValue;
end;

procedure TForm26.PSSCompile(Sender: TPSScript);
begin
Sender.AddFunction(@var2str_func, 'function var2str_func(const AValue: Variant): string;');
Sender.AddMethod(Self, @TForm26.var2str, 'function var2str(AValue: Variant): string;');
end;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant