top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Reducing the binary size?

+3 votes
277 views

Looking some suggestions,
My binary size is huge after compilation, i want it get reduced so that loading is faster. Any input?

My Environement
C, Linux and gcc

posted Oct 30, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

You can do these following things:

1.  Try to remove unused header files.
2.  Try to use shared libraries instead of static libraries. (I am assuming you know the difference between these two)
3.  Not the least use gcc with optimization option i.e (-O , -O1, -O2, -O3 or -Os) capital O not zero. 
    I would suggest to with -Os option.  
    "gcc -Os program_name.c"

Compile your code with and without -O option, and you will see the size differences between these two.

answer Oct 30, 2014 by Arshad Khan
Similar Questions
+4 votes

Assume we have three threads and in this case how can we change the priority of threads. If it is possible then please explain with example.

+4 votes

in case if is it possible, how you can change and pls explain with some example.

+2 votes

Please share a sample program with detail code.

+4 votes

Suppose a programmer wants that generated binary of C program should not work after a fixed number of times(like 5 times).

...