Function returning record was not working in Delphi Pascal script


AM currently using records in delphi. While executing the script which returns the record form script to delphi function, the function was not being called even though it was registered.

Am testing for delphi 64-bit. I have attached the sample app to show the exact problem.
SampleRecordTest.7z (10.1 KB)



Are you using the latest snapshot of Pascal Script?

I don’t see any difference between 32-bit and 64-bit:

we are using the pascal script which was updated on sep’2023.


try to retest with the latest commit:

Revision: 1cabc1730bd510cf6dcb4d5998d3a6ed5366ae8d
Author: Martijn Laan <>
Date: 15.05.2024 19:17:39

it can be downloaded/updated at GitHub - remobjects/pascalscript: pascalscript

It’s the same. I tried to debug the function returning record , but the debugger won’t stop in that function even though there was a breakpoint


as for me, your testcase works the same for win32 and win64 platforms without noticeable differences
Can you update it so it will show different behavior for win32 and win64, pls?

Either 32-bit / 64- bit, the output was not delivered perfectly. Please look into the “Output” folder. In that folder am creating a textfile to save the record content. The file was empty.


as a workaround, you can declare your method as

procedure MyVrm1Editor(s: String; var result: TEditorRule);

in this case, rec.txt will be generated with size 12327 bytes.

It returned the record with a bug. Could you please look into the json variable of record.
I have loaded the file contents into the json variable, but in the output you can see that json variable was null and the content of json variable was in lintmsgs variable which was null.

Am attaching file for reference.
rec.txt (12.0 KB)


you have declared record as

  TEditorRule = packed record
    name, html, js, lintMsgs, json: string;

pay attention, json is last

lets see another your declaration:

    s := ' record name, html, js, json, lintMsgs: string; end';

lintMsgs is last

I think, this describes this “failure”

Thank you very much. It’s working .


As you know, Delphi compiler removes types that aren’t used.

if you modify your initial testcase as

var  d: TEditorRule; //<<< added
  script := LoadDataFromFile

it will work with function MyVrm1Editor(s: String): TEditorRule; too