#1 2018-03-15 12:16:52

camu72
Member
From: Salta - Argentina
Registered: 2015-07-12
Posts: 28

TRawUTF8DynArray error when is used as const parameter - Delphi7

Hi,

I have the follow code:

uses
  ..., 
 SynCommons,
 ....
procedure myProcedure(const FromNames, ToNames: TRawUTF8DynArray);
begin
  DoSomething....;
end;

implementation
....
  myProcedure(['Name1','Name2'],['ToName1', 'ToName2']); // here error on compiling

1) This is de correct way to invoke myProcedure???
2) If this is OK, then in Delphi7, Win7 32bits have de follow error on compilig:

[Error] TestProyect.dpr[xx]: Ordinal type required

What is wrong here?
Thanks.

Last edited by camu72 (2018-03-15 12:18:46)

Offline

#2 2018-03-15 13:53:54

EMartin
Member
From: Buenos Aires - Argentina
Registered: 2013-01-09
Posts: 337

Re: TRawUTF8DynArray error when is used as const parameter - Delphi7

the correct way:

var
  lFromNames, lToNames: TRawUTF8DynArray;
begin
  SetLength(lFromNames,2);
  lFromNames[0] := 'Name1';
  lFromNames[1] := 'Name2';
  SetLength(lToNames,2);
  lToNames[0] := 'ToName1';
  lToNames[1] := 'ToName2';
  myProcedure(lFromNames, lToNames);
end;

Esteban

Offline

#3 2018-03-15 14:38:26

igors233
Member
Registered: 2012-09-10
Posts: 241

Re: TRawUTF8DynArray error when is used as const parameter - Delphi7

That's limitation of D7 (it works in newer Delphi versions).

Workaround is to call it as:
myProcedure(TRawUTF8DynArrayFrom(['Name1','Name2']), TRawUTF8DynArrayFrom(['ToName1', 'ToName2']));

Last edited by igors233 (2018-03-15 14:38:42)

Offline

Board footer

Powered by FluxBB