delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/03/18/19:30:07

From: steve AT dosius DOT zzn DOT com (Dosius)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Question?
Date: 18 Mar 2003 16:26:45 -0800
Organization: http://groups.google.com/
Lines: 42
Message-ID: <9307085f.0303181626.637d558d@posting.google.com>
References: <20030318154745 DOT 95358 DOT qmail AT web40802 DOT mail DOT yahoo DOT com> <3E775D4F DOT EBA1B8E3 AT yahoo DOT com>
NNTP-Posting-Host: 204.168.131.19
X-Trace: posting.google.com 1048033606 16903 127.0.0.1 (19 Mar 2003 00:26:46 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: 19 Mar 2003 00:26:46 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019