I am using Delphi 6, I am preparing a list which will have some variable string name and its pointer reference. Code is some what like,
var
VarList: TstringList;
procedure AddNameList(aName :string; aRef: TObject);
begin
VarList.AddObject(aName, aRef);
end;
Above method AddNameList
is called in Unit1.pas, I have roughly 5 to 6 thousand entries and this can increase.
Now unit1 contains
AddNameList('MyVar1', MyVar1);
AddNameList('MyVar2', MyVar2);
AddNameList('MyVar3', MyVar3);
...
..
..
AddNameList('MyVar5000', MyVar5000);
Compiler is giving me the error
Too many local constants. Use shorter procedures
I tried to divide this in two procedures then also it did not work. I referred posts available and similar to this error, which suggest to use constant arrays. But in that case I need to maintain two constant array and maintaining this two array will be difficult since the number of constant is huge. Is there any other way to resolve this issue.