I'm converting one of our projects from XE4 to XE6. It's gone very smoothly so far, but I've run into an RTTI issue.

I'm converting one of our projects from XE4 to XE6. It's gone very smoothly so far, but I've run into an RTTI issue.

The problem is that if you place the following code in your project file in XE4 RTTI will be disabled globally. in XE6, it only disables RTTI for the current unit.

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

It is very important to for us to reduce the size of the executable as we make remote updates to hundreds of devices running on very slow 2G networks. 1MB can take several minutes to download!

This bug/feature has increased the size of our exe by almost 40%!

How can I disable RTTI globally without having to resort to inserting the above code in every unit?

Marco Cantù

Comments

  1. maybe replace in all files the first "uses" with:

    {$I 'global_stuff.inc'}

    uses 

    and in "global_stuff.inc" you can add that and more?

    ReplyDelete
  2. Dorin Duminica - Yepp, this is my plan B. I would much prefer a method which doesn't require me to alter all the units in the project.

    ReplyDelete
  3. Stefan Glienke - It may be a bug, but it was a very useful one :) How about a couple of new conditionals - $RTTI_GLOBAL and $WEAKLINKRTTI_GLOBAL

    ReplyDelete
  4. Paul Thornton I think using an include file could work, as mentioned the current behavior is what was intended for day 1. We are considering new global settings to control RTTI, but at the soonest they'll become available in the next release.

    ReplyDelete
  5. Marco Cantù I suggest you make them global when put in the dpr/dpk just like it currently is the case for all the other compiler switches.

    ReplyDelete
  6. It should be possible to set these settings in the compiler project options - the free text field.

    Can't check right now.

    ReplyDelete
  7. Hallvard Vassbotn You mean "Conditional defines"? Doesn't work there because these options are not defines but switches. They have no corresponding options in the project options and there is no compiler parameter for them.

    ReplyDelete
  8. Of course, adding proper GUI settings for rtti would even better - and more user friendly. :)

    ReplyDelete
  9. Hallvard Vassbotn I tried that in the past but it did not work, almost every combination.

    ReplyDelete
  10. Dorin Duminica those good old global include files again (:

    ReplyDelete
  11. Jeroen Wiert Pluimers unfortunately... we still have a ton of manual work to do, just because it's 2014, it doesn't mean a developer can't become a typewriter ((:

    ReplyDelete

Post a Comment