Unexpected result of SetLength

Hello,


I have a problem with SetLength. I spent a couple of hours to find the mistake in my program, but now I think it works different in TMSWebCore than in VCL.

My test-code:
Type
TRows2 = array of array of string; // [Cols, Rows]
TCols2 = array of string;

...

procedure TForm_NMain.TMSFNCToolBarButton19Click(Sender: TObject);
var
   Rows1: TRows2;
   Cols1: TCols2;
begin
   SetLength(Cols1,3);
   SetLength(Rows1, Length(Cols1), 1);
   ShowMessage('Cols: '+IntToStr(Length(Cols1))+' Rows: '+IntToStr(Length(Rows1[0])));
end;

I tested it the exact same code in VCL and TMSWebCore:
The result in VCL is like expected = Cols: 3 Rows: 1
The result in TMSWebCore is unexpected = Cols: 3 Rows: 3

How can I fix that?

Many thanks
Patrick

Thanks for reporting. We will verify this with the pas2js compiler engineers.

We have checked this and found the culprit in the pas2js RTL. The next update of TMS WEB Core will have a fix.

Perfect!


Many thanks!

Thank you very much for the fast update. Now it works fine!