News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Download the executable weight

Started by mamama, October 17, 2011, 11:45:21 AM

Previous topic - Next topic

mamama

Hi, I want to know how I can reduce the weight of the generated executable code:: blocks 10.05. In VC + + for example you can pass parameters to the precompiler a section. Data and. Text of the executable, anyone know if doing that is total in C:: B or have any other solution?

greetings.

Freem

go into compiler options, or build options.
Select optimizations and choose the one you prefer.
Uncheck debugging and profiling options too.

Those options are compiler dependent.

If you want to reduce more, some tools could help you by compressing the exe, adding to it a routine to decompress, load the result directly in memory, and call the program, but I don't remember their names.

mamama

I did what you told me to C:: B and I see no real difference, there must be another solution. I do not see a simple GUI normal on WinAPI 927kb occupy me.

greetings.

oBFusCATed

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

mamama


Alpha

Quote from: mamama on October 17, 2011, 03:53:08 PM
Strip all symbols from binary?
Yes.

I assume you are using MinGW; see large executables.

The MinGW flags I have found to produce the smallest binary are "Strip all symbols from binary" and "Optimize generated code for size" under compiler flags,

-fno-rtti
-fno-exceptions
-ffunction-sections
-fdata-sections
-flto

for other compiler options, and

-flto
-Os
-Wl,--gc-sections
-shared-libgcc
-shared-libstdc++

for linker options.  (Note that this will cause the executable to dynamically link to the MinGW run-time libraries.)

Jenna

You can pack the executable with something like upx in the postbuild steps.
In the targets post-build step you can put:
upx --best $TARGET_OUTPUT_FILE
Nite: upx has to be in your search-path, otherwise you have to use the full path for it.