# HG changeset patch # User Oleksandr Gavenko # Date 1263754892 -7200 # Node ID 061995ef35d27f110648915b0c665250875a757d # Parent a58e223b692ff8645aea3ddc4c10c7135f82f0d1 How reduce biraries size. diff -r a58e223b692f -r 061995ef35d2 code-size.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/code-size.rst Sun Jan 17 21:01:32 2010 +0200 @@ -0,0 +1,47 @@ +-*- mode: outline; coding: utf-8 -*- + +* Common. + +** Configuration. + +Configure build with disabling unused features e.g.: + + $ ./configure --without-png + +** Link dynamically. + +Link dynamically instead statically (on your platform shared library may be +already present). + +** Avoid debug build. + +Make release/final build instead debug. + +** Packer. + +Use packers. Packer compress binary so binary smaller. When program load +decompress itself, so startup time increase. + + http://upx.sourceforge.net + home page + +* GCC. + +Use -Os when produce *.o files. + +Use -s when produce executable. +And "--remove-section=.comment and --remove-section=.note". + +Use: + + $ strip --strip-all + +and + + $ gcc -ffunction-sections -fdata-sections -c -o my.o my.c + $ gcc -Wl,--gc-sections -o my my.o + +* MSVC. + +Use /Os when produce *.obj files. +