[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [WIndows] Reducing Lua executable
- From: "李慧霸" <magazine.lihuiba@...>
- Date: Tue, 2 Jun 2009 23:11:08 +0800
Hi,
You can further compress it with upx, and you might
get 50% off :-)
------------------
lihuiba
2009-06-02
-------------------------------------------------------------
>发件人:Bulat Ziganshin
>发送日期:2009-06-02 00:27:22
>收件人:lua@bazar2.conectiva.com.br
>抄送:
>主题:[WIndows] Reducing Lua executable
>
>Hello lua,
Recently i have stripped my lua-containing DLL from 335 down to 139 kbytes.
this letter describes how to do it, i.e. how to decrease Lua
interpreter code from 300 to 100 kbytes
Brief explanation: use either
- Microsoft Visual C++ 6.0 and -MD -O1 compiler options to build Lua
or
- GCC and -Os compiler option to build Lua
Long explanation:
1) You may compile C program to either use built-in libraries (i.e.
added to your exe/dll) or system-wide ones. Later option may increase
your executable size by 150 kb (300->150kb for full Lua implementation)
2) MS compilers uses built-in libs by default (-MD for system
libraries), GCC uses MSVCRT.DLL by default
3) each MS compiler provides its own system-wide DLL: MSVCRT.DLL for
MSVC 6.0, MSVCR70.DLL for MSVS 2002 and so on. as you see, GCC links
to MSVC 6.0 library (MSVCRT.DLL)
4) MSVCRT.DLL shipped with every Windows version starting with Win98,
and may be installed to previous Windows versions either by special
"redistributable" package or by installing Internet Explorer 4.0 (or
later?). MSVCR70.DLL and later may be available only in WinXP or
Vista, or again, may be installed as "redistributable" packages. So,
in most cases, you may be sure that user's computer has MSVCRT.DLL but
presence of newer versions are questionable
5) so, in most cases, you may compile your program to use MSVCRT.DLL
using MSVC 6.0 or GCC and expect that user's computer will be happy
with that executable
6) with special tricks, you may compile program to use of MSVCRT.DLL
even with MSVS 2002 or later
7) also, with MSVS 2002 or later you may use -MD option to make
program that uses MSVCR70.DLL or later, but then your user may need to
install appropriate DLL via "redistributable" package
8) in order to further decrease Lua executable size, you may use
size-optimization option, that is -O1 for MS and -Os for GCC compilers
Further reading:
http://kobyk.wordpress.com/2007/07/20/dynamically-linking-with-msvcrtdll-using-visual-c-2005/
http://nn1234.wordpress.com/2008/04/11/vc-90-msvcrtdll-windows-95/
http://www.legacyextender.com/
--
Best regards,
Bulat mailto:Bulat.Ziganshin@gmail.com
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4025 (20090421) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
>