I'm trying to have RTTI enabled only for a subset of my classes.
The reason is that for those classes for which I want RTTI, I want RTTI on public methods too, but if that is enabled project-wide, then all public methods from all classes get into the final executable. This basically turns off the smart-linking, as the compiler considers that every public method could be called at runtime, and thus ends up compiling pretty much everything and the kitchen sink into the executable...
I've tried several things:
{$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}
and then re-enabling it for the relevant units results in crashes at compile time (an AV somewhere in the compiler) on the $RTTI directive.Any other ideas?
Compiler bug submitted as QC 98261 for Embarcadero consideration.
The runtime AV was related to attributes, so a workaround is to make sure (manually, there are no compiler errors or warnings) that the attributes used in the exposed classes all have RTTI for them, otherwise you get the unqualified runtime AV.
The compiler AV happens whenever the $RTTI directive is used before the "unit" statement of a unit, if you place it after the AV doesn't happen and it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With