I have upgraded an old 32 bit app into 64bit. I am having trouble running imported functions that have parameters. To test I have used the Unit Importer to import 3 test functions shown below.

The first function has no parameters and works fine - it returns the main form caption.

The second function has an parameter aStringIn : string - calling this in my script is causing an access violation??

The third function has the same problem as the second - it seems that any functions with parameters are failing?

The code worked fine in the older version of delphi and there are no errors compiling.

What could possibly be going wrong with the functions imported by using the Unit Importer?

Standard functions defined by Pascal Scripter ie StrToInt64 are working fine…

function TestString: string;
begin
Result := AppTitle; {AppTitle is a function that returns the form caption as a string}
end;

function TestStringIn(aStringIn : string) : string;
begin
Result := aStringIn;
end;

function IsEmptyGuid(const aGuid : TGuid) : Boolean;
begin
Result := IsEqualGuid(aGuid, GUID_NULL);
end;

what version/revision of Pascal Script you have used?
the latest revision of https://github.com/remobjects/pascalscript ?
if not, can you retest with the latest revision, pls?

I have used the latest version at GitHub - remobjects/pascalscript: pascalscript . I have found that compiling as 32bit the problem dissappears. The issue is only there when compiling in 64 bit.

I can’t reproduce any failure with the standard TestApp sample & win64 and this script

program Test;
function TestString: string;
begin
Result := Application.MainForm.Caption;
end;
function Echo(value: string): string;
begin
Result := value;
end;
function IsEqualGuid(const aGuid1,aGuid2 : TGuid): Boolean;
begin
Result := (aGuid1.d1=aGuid2.d1) and
(aGuid1.d2=aGuid2.d2) and
(aGuid1.d3=aGuid2.d3) and
(aGuid1.d4[0]=aGuid2.d4[0]) and
(aGuid1.d4[1]=aGuid2.d4[1]) and
(aGuid1.d4[2]=aGuid2.d4[2]) and
(aGuid1.d4[3]=aGuid2.d4[3]) and
(aGuid1.d4[4]=aGuid2.d4[4]) and
(aGuid1.d4[5]=aGuid2.d4[5]) and
(aGuid1.d4[6]=aGuid2.d4[6]) and
(aGuid1.d4[7]=aGuid2.d4[7]);
end;
function GUID_NULL: TGuid;
begin
Result.d1 := 0;
Result.d2 := 0;
Result.d3 := 0;
Result.d4[0] := 0;
Result.d4[1] := 0;
Result.d4[2] := 0;
Result.d4[3] := 0;
Result.d4[4] := 0;
Result.d4[5] := 0;
Result.d4[6] := 0;
Result.d4[7] := 0;
end;
function GUID1: TGuid;
begin
Result.d1 := 1;
Result.d2 := 1;
Result.d3 := 1;
Result.d4[0] := 0;
Result.d4[1] := 0;
Result.d4[2] := 0;
Result.d4[3] := 0;
Result.d4[4] := 0;
Result.d4[5] := 0;
Result.d4[6] := 0;
Result.d4[7] := 0;
end;
function IsEmptyGuid(const aGuid : TGuid) : Boolean;
begin
Result := IsEqualGuid(aGuid, GUID_NULL);
end;
begin
writeln(TestString);
writeln(Echo('aaa'));
if IsEmptyGuid(GUID1) then
writeln('empty')
else
writeln('not empty');
end.