I’m new in Delphi and I was migrating a very old Delphi project to Embarcadero RAD Studio 2010. I found a problem using strings. Here is the code:
ProgramaResultadosType = record
Version: string;
TituloPrincipal : string;
BloquesResultados : VectorBloquesResultadosType;
end;
FileOfProgramaResultadosType = file of ProgramaResultadosType;
And the error…
“E2155 Type ‘%s’ needs finalization – not allowed in file type”
I know it’s a well-known error for many delphi developers when you don’t specify the string size.
Basically I would like to deactivate Huge strings directive like older versions of RAD Studio, but I can’t find out in the 2010 version.
Just use instead:
But be aware that:
stringtype: you should better use another explicitstringvariable just after having read theshortstringcontent;stringis an Unicode string: so you may lose some data when writing into ashortstring(which is an Ansi string) from anUnicodeString;ProgramaResultadosType = packed recordcould be necessary if your application is very very old (default alignment changed around Delphi 4, AFAIR).So you may have to:
Worth reading when converting an existing application to newer Unicode version of Delphi: