| |
 |
|
| Science Forum Index » Compression Forum » Which compiler to create small windows exe's ??... |
|
Page 1 of 1 |
|
| Author |
Message |
| Bedwal_Da_Bond... |
Posted: Sat Jul 04, 2009 11:12 pm |
|
|
|
Guest
|
Hi all,
At the moment i am using DevC++, it produces very large exe's. I have
ried many compiler options, but still its way too big (around 200K,
whereas i need around 5-10K, and the code is not much 2-3K
Please suggest me a better (or the best ) compiler to do it.
Thanx.
Jitender |
|
|
| Back to top |
|
|
|
| Phil Carmody... |
Posted: Sun Jul 05, 2009 3:40 am |
|
|
|
Guest
|
Bedwal_Da_Bond <jai1988bajrangbali at (no spam) gmail.com> writes:
[quote:96961df36a]Hi all,
At the moment i am using DevC++, it produces very large exe's. I have
ried many compiler options, but still its way too big (around 200K,
whereas i need around 5-10K, and the code is not much 2-3K
Please suggest me a better (or the best ) compiler to do it.
[/quote:96961df36a]
Using C++ and desiring something small will lead to disappointment.
Try a different language. You can get smaller with C, but nothing
will beat well-crafted assembly language.
Phil
--
Marijuana is indeed a dangerous drug.
It causes governments to wage war against their own people.
-- Dave Seaman (sci.math, 19 Mar 2009) |
|
|
| Back to top |
|
|
|
| cr88192... |
Posted: Sun Jul 05, 2009 4:40 pm |
|
|
|
Guest
|
"Bedwal_Da_Bond" <jai1988bajrangbali at (no spam) gmail.com> wrote in message
news:964abdf8-b57f-4b0f-9119-ac7b7ad38c13 at (no spam) u16g2000pru.googlegroups.com...
[quote:e717a5ae12]Hi all,
At the moment i am using DevC++, it produces very large exe's. I have
ried many compiler options, but still its way too big (around 200K,
whereas i need around 5-10K, and the code is not much 2-3K
Please suggest me a better (or the best ) compiler to do it.
[/quote:e717a5ae12]
use C or ASM, and avoid and C runtime calls.
actually, this may be harder, since control will often be transferred to a
special stub (often called 'crt0.o' and containing '_start' or similar),
which will initialize the C library, followed by transferring control over
to 'main' or 'WinMain' (although sometimes the init code is embedded
directly into 'main', so it depends on various factors, such as compiler and
build target...).
avoiding this then, may well require providing ones' own entry stub, in
assembler, and then staying clear of any and all runtime calls (on both
Windows and Linux there are ways to address the kernel directly, and AFAIK
in Windows it is possible to use DOS-style 'int 21h' calls to access
kernel-provided services in 32-bit code, presumably with a similar interface
to DOS, but this would likely need verification, whereas on Linux it is 'int
80h' and uses a somewhat different interface...).
one could then continue using C, by manually invoking it from ASM, and
providing their own (ASM based) interfaces into the OS kernel.
otherwise, there is no real way out of it, one will have to tolerate some
level of additional code making their EXE bigger (after all, this does such
useful things as giving one calls such as 'fopen', 'printf', 'malloc', ...).
or such...
[quote:e717a5ae12]Thanx.
Jitender[/quote:e717a5ae12] |
|
|
| Back to top |
|
|
|
| cr88192... |
Posted: Sun Jul 05, 2009 4:58 pm |
|
|
|
Guest
|
"cr88192" <cr88192 at (no spam) hotmail.com> wrote in message
news:h2ra5h$ncn$1 at (no spam) news.albasani.net...
[quote:904ffde1d9]
"Bedwal_Da_Bond" <jai1988bajrangbali at (no spam) gmail.com> wrote in message
news:964abdf8-b57f-4b0f-9119-ac7b7ad38c13 at (no spam) u16g2000pru.googlegroups.com...
Hi all,
At the moment i am using DevC++, it produces very large exe's. I have
ried many compiler options, but still its way too big (around 200K,
whereas i need around 5-10K, and the code is not much 2-3K
Please suggest me a better (or the best ) compiler to do it.
use C or ASM, and avoid and C runtime calls.
actually, this may be harder, since control will often be transferred to a
special stub (often called 'crt0.o' and containing '_start' or similar),
which will initialize the C library, followed by transferring control over
to 'main' or 'WinMain' (although sometimes the init code is embedded
directly into 'main', so it depends on various factors, such as compiler
and build target...).
avoiding this then, may well require providing ones' own entry stub, in
assembler, and then staying clear of any and all runtime calls (on both
Windows and Linux there are ways to address the kernel directly, and AFAIK
in Windows it is possible to use DOS-style 'int 21h' calls to access
kernel-provided services in 32-bit code, presumably with a similar
interface to DOS, but this would likely need verification, whereas on
Linux it is 'int 80h' and uses a somewhat different interface...).
one could then continue using C, by manually invoking it from ASM, and
providing their own (ASM based) interfaces into the OS kernel.
otherwise, there is no real way out of it, one will have to tolerate some
level of additional code making their EXE bigger (after all, this does
such useful things as giving one calls such as 'fopen', 'printf',
'malloc', ...).
[/quote:904ffde1d9]
addition:
one can use import libraries, and thus gain access to DLLs (and thus the
Win32 API), however, this will very quickly get one back up into the 10's or
100's of kB for the EXE range...
similarly, attempting to implement such functionality for themselves (for
example, a working 'malloc' implementation...), will also inflate the size
of the EXE, very possibly, back up into these ranges...
so, it is, in a way sort of a necessary evil...
one can just be glad they are not doing a non-trivial app, where one may
easily find even just their own code measuring in the 10s of MB, by far
dwarfing that of the runtime libraries...
similarly, from what I can gather (going and looking around), the 'int 21h'
calls are more provided as a sort of 'backwards compatibility' feature
(rather than an interface into the kernel...).
that is, of course, assuming they work correctly (or at all) from native
32-bit code (I had heard that they do, but have not personally verified
this...).
[quote:904ffde1d9]
or such...
Thanx.
Jitender
[/quote:904ffde1d9] |
|
|
| Back to top |
|
|
|
| Fibonacci Code... |
Posted: Mon Jul 06, 2009 4:51 am |
|
|
|
Guest
|
On Jul 5, 5:12 pm, Bedwal_Da_Bond <jai1988bajrangb... at (no spam) gmail.com>
wrote:
[quote:b186bcdc02]Hi all,
At the moment i am using DevC++, it produces very large exe's. I have
ried many compiler options, but still its way too big (around 200K,
whereas i need around 5-10K, and the code is not much 2-3K
Please suggest me a better (or the best ) compiler to do it.
Thanx.
Jitender
[/quote:b186bcdc02]
There is a program call UPX which is exe packer,
the resultant exe is very small yet executable.
Regards,
fibonacci |
|
|
| Back to top |
|
|
|
| cr88192... |
Posted: Mon Jul 06, 2009 10:26 am |
|
|
|
Guest
|
"Fibonacci Code" <anglikai at (no spam) gmail.com> wrote in message
news:4849bd96-72fb-4cf0-9de9-f722d8138d32 at (no spam) q40g2000prh.googlegroups.com...
On Jul 5, 5:12 pm, Bedwal_Da_Bond <jai1988bajrangb... at (no spam) gmail.com>
wrote:
[quote:c25bf3688e]Hi all,
At the moment i am using DevC++, it produces very large exe's. I have
ried many compiler options, but still its way too big (around 200K,
whereas i need around 5-10K, and the code is not much 2-3K
Please suggest me a better (or the best ) compiler to do it.
Thanx.
Jitender
[/quote:c25bf3688e]
<
There is a program call UPX which is exe packer,
the resultant exe is very small yet executable.
[quote:c25bf3688e]
[/quote:c25bf3688e]
yep, and this actually works as all the needed code is still present in the
EXE...
granted, compression will not make the EXE "magically small", just somewhat
smaller... |
|
|
| Back to top |
|
|
|
| Bedwal_Da_Bond... |
Posted: Mon Jul 06, 2009 11:46 pm |
|
|
|
Guest
|
On Jul 6, 9:26 pm, "cr88192" <cr88... at (no spam) hotmail.com> wrote:
[quote:351ee8b128]"Fibonacci Code" <angli... at (no spam) gmail.com> wrote in message
news:4849bd96-72fb-4cf0-9de9-f722d8138d32 at (no spam) q40g2000prh.googlegroups.com...
On Jul 5, 5:12 pm, Bedwal_Da_Bond <jai1988bajrangb... at (no spam) gmail.com
wrote:
Hi all,
At the moment i am using DevC++, it produces very large exe's. I have
ried many compiler options, but still its way too big (around 200K,
whereas i need around 5-10K, and the code is not much 2-3K
Please suggest me a better (or the best ) compiler to do it.
Thanx.
Jitender
There is a program call UPX which is exe packer,
the resultant exe is very small yet executable.
yep, and this actually works as all the needed code is still present in the
EXE...
granted, compression will not make the EXE "magically small", just somewhat
smaller...
[/quote:351ee8b128]
Thank you all,
I' ll settle for lcc32 (C-compiler) + UPX, it gave me 9.8KB. Thank you
very much. |
|
|
| Back to top |
|
|
|
|
|
All times are GMT - 5 Hours
The time now is Sat Nov 21, 2009 10:11 am
|
|