gioma 20 Posted Monday at 04:38 PM Hi, I have a project in Delphi 12.2 of an exe that extracts other EXEs always made with delphi. I would like to reduce the weight of these executables, I thought of using the "Link with runtime package" option and linking the programs with the two largest BPLs VCLxxx.BPL and RTLxxx.BPL. The problem is that adding RTL to the list of "Runtime packages" does not produce any reduction in the weight of the EXE. Why I get this result? Thanks Share this post Link to post
Remy Lebeau 1466 Posted Monday at 07:14 PM Does your project use multiple build configurations (debug/release, 32bit/64bit, etc)? Do you have the runtime packages applied to every configuration? Share this post Link to post
gioma 20 Posted 18 hours ago (edited) I only set these options for the release build. A strange thing happens: if I add only "vcl" when I start the EXE, it requires both VCL and RTL. Why is this? Edited 18 hours ago by gioma Share this post Link to post
Remy Lebeau 1466 Posted 17 hours ago 12 minutes ago, gioma said: if I add only "vcl" when I start the EXE, it requires both VCL and RTL. Why is this? Because the VCL depends on the RTL. If you use the Runtime Package for the VCL then you need the Runtime Package of the RTL as well. 1 Share this post Link to post
gioma 20 Posted 17 hours ago But I don't get it, compared to two BPLs weighing a total of about 22 MB, I only have a saving of 6 MB... mah! Share this post Link to post
Uwe Raabe 2082 Posted 17 hours ago That is most likely because you only use a small part of these packages. When building a monolithic exe the compiler will only take the parts actually used, but the packages contain a lot more. 2 Share this post Link to post
A.M. Hoornweg 145 Posted 16 hours ago I have made an application that copies the Delphi RTL/VCL source files into a temporary folder, inserts the text '{$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}' in the right places and re-builds the whole lot. The compiled *.dcu files contain a lot less RTTI than before. By linking against this compacted RTL I achieve a size reduction in a 64-bit VCL application from 14 MB to 10.3 MB using Delphi 12. For just a single executable that isn't worthwhile, but I use this in some multi-module projects that consist of a few dozen ActiveX EXE's and DLL'S. There the cumulative size reduction is substantial. Proper testing is hugely important, one has to be sure that the missing RTTI doesn't cause the program to malfunction. 1 Share this post Link to post
Ian Branch 131 Posted 8 hours ago If it simply the size of the .exe you are looking to reduce, I use UPX, https://github.com/upx/upx/releases, it handles 32 & 64 bit Apps. I use a compression value of 7 and get a roughly 30% reduction in .exe size. It will also handle wild card file names, i.e. upx -7 *.exe. Share this post Link to post
Brandon Staggs 311 Posted 7 hours ago 24 minutes ago, Ian Branch said: If it simply the size of the .exe you are looking to reduce, I use UPX, https://github.com/upx/upx/releases, it handles 32 & 64 bit Apps. I use a compression value of 7 and get a roughly 30% reduction in .exe size. It will also handle wild card file names, i.e. upx -7 *.exe. Never do this. It's pointless, defeats stuff the OS does to make accessing data in the file efficient, triggers more false-positives, and provides no real benefits, unless you are dealing with a severe lack of storage on the deployment target, which should be fixed in other ways. You can zip the file for transmission bandwidth savings. 4 Share this post Link to post
aehimself 401 Posted 7 hours ago 1 hour ago, Ian Branch said: If it simply the size of the .exe you are looking to reduce, I use UPX, https://github.com/upx/upx/releases, it handles 32 & 64 bit Apps. I use a compression value of 7 and get a roughly 30% reduction in .exe size. It will also handle wild card file names, i.e. upx -7 *.exe. I'd strongly advise against UPX especially in production executables. I had my fair share of after-the-last-moment struggle because of it 1 Share this post Link to post
Ian Branch 131 Posted 3 hours ago Hi Guys, I acknowledge the previous two commentors and their valid inputs, however it is horses for courses. I was simply offering a suggestion. I have used UPX for many years without any issues. Note: I use Eurekalog not MadExcept. It provides not only compression, but also therefore a small level of obfuscation to casual file browsers. That is all I need. 4 hours ago, Brandon Staggs said: defeats stuff the OS does to make accessing data in the file efficient Like? 4 hours ago, Brandon Staggs said: You can zip the file for transmission bandwidth savings. Yes I could, but, the other end is so computer illiterate that they would screw up the unzip and save process. Pacific island users. It has to be simple for them to just copy into their directory. Even then they screw it up sometimes...:-( Share this post Link to post