| Computers Forum Index » Computer Compilers - LCC » lcc-win32... Hello World exe is twice the size as... |
|
Page 1 of 1 |
|
| Author |
Message |
| ... |
Posted: Sun May 31, 2009 3:28 am |
|
|
|
Guest
|
I built a simple hello world application in lcc-win32:
#include <stdio.h>
int main(void);
int main(void) {
printf("hello world\n");
return 0;
}
Originally, lcc-win32 builds an exe of 100kb! I found out how to get
the exe size down to 31kb by unchecking the Compiler > Generate debug
info under Project Configuration, but 31kb is almost twice the size of
the exact same code under WinGW, which builds an exe of only 16kb.
Is this a result of a completely different stdio.h file?
Are there any other optimizations or settings that I can do under lcc-
win32 to get the filesize down to a more respectable size?
Thanks! |
|
|
| Back to top |
|
|
|
| BartC... |
Posted: Sun May 31, 2009 5:54 pm |
|
|
|
Guest
|
<blake.zuckerman at (no spam) gmail.com> wrote in message
news:413eaebf-6fa4-4753-ad7b-c715e0fbe92b at (no spam) k38g2000yqh.googlegroups.com...
Quote: I built a simple hello world application in lcc-win32:
#include <stdio.h
int main(void);
int main(void) {
printf("hello world\n");
return 0;
}
Originally, lcc-win32 builds an exe of 100kb! I found out how to get
the exe size down to 31kb by unchecking the Compiler > Generate debug
info under Project Configuration, but 31kb is almost twice the size of
the exact same code under WinGW, which builds an exe of only 16kb.
Is this a result of a completely different stdio.h file?
Are there any other optimizations or settings that I can do under lcc-
win32 to get the filesize down to a more respectable size?
I don't know about switches for lcc.exe. If you link separately with
lcclnk.exe you can use:
lcclnk -dynamic -S -o hello.exe hello.obj
for example, to reduce the size. Your example reduced to about 3600 bytes.
--
Bart |
|
|
| Back to top |
|
|
|
| ... |
Posted: Sun May 31, 2009 9:04 pm |
|
|
|
Guest
|
On May 31, 6:54 am, "BartC" <ba... at (no spam) freeuk.com> wrote:
Quote: blake.zucker... at (no spam) gmail.com> wrote in message
news:413eaebf-6fa4-4753-ad7b-c715e0fbe92b at (no spam) k38g2000yqh.googlegroups.com...
I built a simple hello world application in lcc-win32:
#include <stdio.h
int main(void);
int main(void) {
printf("hello world\n");
return 0;
}
Originally, lcc-win32 builds an exe of 100kb! I found out how to get
the exe size down to 31kb by unchecking the Compiler > Generate debug
info under Project Configuration, but 31kb is almost twice the size of
the exact same code under WinGW, which builds an exe of only 16kb.
Is this a result of a completely different stdio.h file?
Are there any other optimizations or settings that I can do under lcc-
win32 to get the filesize down to a more respectable size?
I don't know about switches for lcc.exe. If you link separately with
lcclnk.exe you can use:
lcclnk -dynamic -S -o hello.exe hello.obj
for example, to reduce the size. Your example reduced to about 3600 bytes..
--
Bart
That does reduce the filesize significantly, but the application will
fail on installations where the lcclib.dll is not present. Not quite
the solution I was looking for as I would like the application to be
self contained. |
|
|
| Back to top |
|
|
|
| jacob navia... |
Posted: Mon Jun 01, 2009 2:17 am |
|
|
|
Guest
|
blake.zuckerman at (no spam) gmail.com wrote:
Quote: I built a simple hello world application in lcc-win32:
#include <stdio.h
int main(void);
int main(void) {
printf("hello world\n");
return 0;
}
Originally, lcc-win32 builds an exe of 100kb! I found out how to get
the exe size down to 31kb by unchecking the Compiler > Generate debug
info under Project Configuration, but 31kb is almost twice the size of
the exact same code under WinGW, which builds an exe of only 16kb.
Is this a result of a completely different stdio.h file?
Are there any other optimizations or settings that I can do under lcc-
win32 to get the filesize down to a more respectable size?
Thanks!
#include <stdio.h
int main(void)
{
puts("Hello world");
}
That is 13K
printf is a big function, but with Mingw it is stored in the
dll crtdll.dll. If you would count the size
of that dll, the program woukd make 100K.
I do not use that dll any more since it has too many bugs!
The executables of lcc-win are still smaller than Mingws! |
|
|
| Back to top |
|
|
|
| BartC... |
Posted: Mon Jun 01, 2009 2:35 am |
|
|
|
Guest
|
blake.zuckerman at (no spam) gmail.com wrote:
Quote: On May 31, 6:54 am, "BartC" <ba... at (no spam) freeuk.com> wrote:
blake.zucker... at (no spam) gmail.com> wrote in message
news:413eaebf-6fa4-4753-ad7b-c715e0fbe92b at (no spam) k38g2000yqh.googlegroups.com...
#include <stdio.h
int main(void);
int main(void) {
printf("hello world\n");
return 0;
}
Originally, lcc-win32 builds an exe of 100kb! I found out how to get
the exe size down to 31kb by unchecking the Compiler > Generate
debug info under Project Configuration, but 31kb is almost twice
the size of the exact same code under WinGW, which builds an exe of
only 16kb.
Is this a result of a completely different stdio.h file?
Are there any other optimizations or settings that I can do under
lcc- win32 to get the filesize down to a more respectable size?
I don't know about switches for lcc.exe. If you link separately with
lcclnk.exe you can use:
lcclnk -dynamic -S -o hello.exe hello.obj
for example, to reduce the size. Your example reduced to about 3600
bytes.
That does reduce the filesize significantly, but the application will
fail on installations where the lcclib.dll is not present. Not quite
the solution I was looking for as I would like the application to be
self contained.
You mean you want the C runtime functions to be statically linked? I don't
know how you'd get it below 30KB, maybe the lcc versions just happen to be
more extensive.
The -dynamic flag means the runtime functions are loaded from a DLL, and
Windows comes with such a DLL, msvcrt.dll for example. However trying to
include \lcc\lib\msvcrt.lib in the linker files didn't work; there still
seems to be something it needs from lcclibc.dll. I think we need some proper
lcc experts here...
--
Bart |
|
|
| Back to top |
|
|
|
|