Where is this clear "default is false" indication in the docs ?
RTTI generation has always been "off" by default (as a project wide
setting), unless a class extends a type for which RTTI was previously
enabled. But I can't find any reference to _extended_ RTTI being disabled
Note also that another (new) option that is OFF by default is WEAKLINKRTTI.
This controls whether methods that are discoverable by RTTI are linked
even if not directly used. With this ON, then code that would normally be
excluded by the linker, because it is not referenced, will still be linked
_just in case_ they may be discovered and invoked at runtime thru RTTI.
i.e. If you have not turned WEAKLINKRTTI *ON* then any method for which
RTTI is generated will be linked in, even if never called. I don't see any
obviously named project level setting for this, so this directive
presumably has to be included in every unit where you wish to suppress this
behaviour (and thus cannot be applied to VCL units without jumping through
With all that in mind, now, try this...
in XE2... create a new VCL Forms application. You can even check that the
"Enable RTTI" project setting is indeed the default FALSE setting if you
wish. Now drop a TListBox on the default form (ListBox1). Then add this
code to the FormCreate event:
rtti := TRttiContext.Create;
lType := rtti.GetType(self.ClassType);
lMethods := lType.GetMethods;
for lMethod in lMethods do
This will list over 170 methods for TForm1 for which RTTI information
Do the equivalent thing in a version of Delphi prior to D2010 when this
extended RTTI was introduced, and you will get just 1: the FormCreate
event handler method itself.
Notice also that even if you add the following directive immediately prior
to the TForm1 declaration, you still get the same list of 178 methods, even
tho the directive appears to (and should, according to the documentation)
disable ALL RTTI for that class:
Whether this is some misunderstanding of how this directive is supposed to
work, or a bug in the compiler ignoring the directive (no RTTI declaration
of any form appears to make any difference at all), I don't know.
Yes, Unicode will have some impact too but I am pretty sure that the new
RTTI features that your code now enjoys (without having asked for it, and
presumably without even needing it) are the main source for the sudden
increase in EXE size.
> re: RTTI
> > imho this sort of change should be opt-IN, not opt-OUT.
> XE2 help clearly says the defaut is false, and that's the case for the
> three projects I'm
> working on at present. So the bloat that John reports must come from other
> I think it must be related to the Unicode (or similar) changes as, for my
> apps at least, the big
> increment - about 70% - came in the shift from D2007 to D2010.
> Even so, there was a noticeable (20%) jump between D2010 and XE2.
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi@list... > Admin: http://delphi.org.nz/mailman/listinfo/delphi > Unsubscribe: send an email to delphi-request@list... with
> Subject: unsubscribe