From: Elliott Oti Newsgroups: comp.os.msdos.djgpp Subject: Re: How can I reduce the compiled executable size? Date: Sat, 04 Jan 1997 05:59:25 -0800 Organization: Academic Computer Centre Utrecht, (ACCU) Lines: 41 Message-ID: <32CE623D.279B@stud.warande.ruu.nl> References: NNTP-Posting-Host: warande1078.warande.ruu.nl Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Matthew Kennedy wrote: > > POINT!!!: Why does the addition of gotoxy(1,1) add 40k of code the the > size of the executable?? In assembler such an addition would be about 10 > bytes! > How can I stop the whole conio (I assume) library from being linked in???? > > Thankyou. Using one function doesn't automatically link in the entire library. The conio functions are contained in libc.a (methinks), which is a half-meg in size. Fact is, these functions are whoppers in size, along with startup code, error checking,exit code, additions to the symbol table etc. Plus you're compiling without optimisations ( tho' in such a tiny prog that doesn't matter too much). What to do? 1.Reduce the *.exe file size: Compile with optimisations and output *.out. (Not -O3 or -m486, tho') then strip myprog.out and coff2exe myprog.out to dump the symbol table. Run djp myprog.exe and voila! a teensy weensy compact li'l program. 2.Write your own DOS conio functions. No, that's not hard, just timeconsuming. Here is gotoxy() using the BIOS video function 10h: #include void Matts_Gotoxy(char x, char y,char page) // page = video page; default = 0 { union REGS r; r.h.ah = 0x2; r.h.bh = page; r.h.dh = y; r.h.dl = x; int86(0x10,&r,&r); } And then the remaining 20+ functions. Good luck, Elliott