It has nothing to do with dynamic arrays as such. It has to do with stdin/out/err or in real Pascal Output/Input and ErrOutput handles missing in GUI Apps.
That can be mitigated by creating a console:
As suggested above by creating a console in code
Or as I suggested previously: {$apptype console}
It is also a Windows only issue.
On Windows write/writeln/read/readln need console handles.
You can also redirect the console handles: that would be the better option.
I actually consider this a bug in Lazarus for the Windows versions, but the Laz developers do not agree.
In unix there is no problem, since the handles are always there and can be handled (sic) as if a file.
The latter can be /dev/null since that is a "file" stored in oblivion. Windows has no direct equivalent. (well, it has, but needs some stiff coding)
You can defer to wsprintf as an alternative without writing too much code:
You can make it look like write/writeln...,,