Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve RTTI size issue for large Enum types in Delphi XE?

I get this error when I try to compile a unit with a Enum type with 5000+ values in Delphi XE

[DCC Error] uCities.pas(5834): E2575 RTTI for 'TCity' is too large; reduce scope with $RTTI or reduce type size

How can I solve this?

Things like

{$WEAKLINKRTTI ON}
{$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}

didn't help.

thanks in advance

like image 716
Haruki Avatar asked Dec 16 '22 11:12

Haruki


1 Answers

You're using an enum to list cities ??? That's new.

It's better using an lookup data structure than an enum.

EDIT: you can use, for example, an TClientDataset or you can use an TDictionary (from Generics.Collections unit) if you do any kind of lookup (get the string name of the city from an TCity value).

And help people here to help you: TCidade will not make any sense to those that can't read Portuguese but with TCity people can get a better understanding about what your problem is.

like image 126
Fabricio Araujo Avatar answered Dec 28 '22 07:12

Fabricio Araujo