Jump to content
A.M. Hoornweg

Recompile Delphi RIO RTL/VCL?

Recommended Posts

Hello all,

 

I would like to re-build Delphi's RTL/VCL without RTTI for a certain project in which the compiled size of the DLL's and executables is important.   I'd be very grateful if someone could supply some insight or maybe a script to accomplish it.   I have no problem doing so using Delphi XE but Delphi Rio is giving me a hard time.

Share this post


Link to post

Not 100% sure if there is some unclean code somewhere, but if you don't bind Rtti-Units it won't be linked to the project.

Since I have to use Rtti I'm not aware of any wrong linking, please keep me updated where this happens exactly.

 

Share this post


Link to post

@Rollo62 @Kryvich {$RTTI} directive has local scope. That means you cannot set it for whole project and have it applied on everything.

 

If you want to remove advanced RTTI from RTL/VCL, you have to recompile RTL/VCL, which is what OP wants. 

 

As far as recompiling Rio RTL/VCL is concerned, I haven't tried to do it... so I don't know what are the problems and even less what would be solution.

Share this post


Link to post
If you want to remove advanced RTTI from RTL/VCL, you have to recompile RTL/VCL, which is what OP wants. 

@Dalija

Interesting. How much MB would we gain from removing Rtti in system libs ?

I've never considered to remove anything from there, as I think its probably not worth to consider memory space in 21th century.
Maybe this is another story with mobile devices still.

Anyway, I use Rtti, so maybe I have to consider this in my next project.

Edited by Rollo62

Share this post


Link to post
1 hour ago, Rollo62 said:

If you want to remove advanced RTTI from RTL/VCL, you have to recompile RTL/VCL, which is what OP wants. 

I've never considered to remove anything from there, as I think its probably not worth to consider memory space in 21th century.
Maybe this is another story with mobile devices still.
 

 

It may not be a problem with single-executable applications, but RTTI overhead really becomes an issue if we're talking about a modular application suite consisting of dozens of DLL's (mostly COM servers).  If each and every one of these DLL's carries the RTTI overhead of much of the RTL and/or VCL, it simply adds up.  Which is totally tragic if the project doesn' even use any of it.  And before you ask, no, runtime packages aren't an option here.   But apart from that,  from an intellectual property point of view we simply think it is undesirable that our competitors could inspect the objects in our compiled executables.  

 

1 hour ago, Rollo62 said:

 

7 hours ago, Kryvich said:

Perhaps this will help:

 

Hello,

 

that's pretty much how I do it using Delphi XE. I copy all RTL/VCL units into a temporary subdirectory, then reference all these units in a small dummy console program (having the RTTI directives mentioned in the link above) and then perform a full build of this dummy project. The resulting bunch of DCUS can then be used instead of the regular RTL/VCL (just set a project's search path to the directory containing the dcus) and it will produce vastly smaller executables. 

 

Unfortunately, in newer Delphi versions these RTTI settings can no longer be specified per-project, they must be set per-unit, requiring a manual change of every unit and that's many hundreds of them. I was hoping there would be a way around that.

 

 

Share this post


Link to post

@A.M. Hoornweg In newer Delphi versions you must put the $RTTI directive on each library unit. This is the main difference from XE.

 

@Rollo62 I brought some statistics for my applications here: 

 

Edited by Kryvich

Share this post


Link to post
2 hours ago, Kryvich said:

 

@Rollo62 I brought some statistics for my applications here: 

 

Yes, thanks. Seems I missed this interesting post before.
I didn't expect that much influence, also very intersting ist the LVCL project from Arnoud.

7 hours ago, Arnaud Bouchez said:

Thanks god I'm not pushing towards smallest memory footprint on VCL, but maybe a LFMX project will be interesting one day :classic_blink:

Edited by Rollo62

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×