Mail Archives: djgpp/2003/03/18/19:30:07
CBFalconer <cbfalconer AT yahoo DOT com> wrote in message news:<3E775D4F DOT EBA1B8E3 AT yahoo DOT com>...
> adel khaleghi wrote:
> >
> > I have a question.
> >
> > I compiled following code with gcc and borland c compiler:
> >
> > #include <stdio.h>
> >
> > int main(void){
> > printf("Hello world!");
> > return 0;
> > }
> >
> > gcc a.c -o a.exe (for gcc compiler under windows)
> >
> > the size of exe file that gcc maked (80KB) and the
> > size of exe file that borlandc maked (8KB) . why???
>
> DJGPP is including lots and lots of run-time code to make the
> underlying system function very much like Unix/Linux/Posix, and is
> probably including lots of debug information. You don't specify
> which BC you used, but it isn't doing all that. For another
> level, you can create the same program in under 30 bytes with
> assembly.
Something like this? ;)
(I have only included the main function. I can't pull any more off
the top of my head, unfortunately; ASM is not my forte. "org 0100h" is
a given.)
Main proc near
mov dx, offset msg
mov ax, 9 ;wrstr()
int 21h
mov ax, 4Ch ;exit()
int 21h
msg: db 'Hello world!$'
end Main
-uso.
- Raw text -