Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!strath-cs!cs.glasgow.ac.uk!icdoc!qmw-cs!liam From: liam@cs.qmw.ac.uk (William Roberts;) Newsgroups: comp.unix.aux Subject: Re: Why is this one line program SOOOO LOOOOOONNNNNNNNGGGGGGGG? Message-ID: <2839@redstar.cs.qmw.ac.uk> Date: 11 Jan 91 12:57:48 GMT References: <18800.278d2d55@windy.dsir.govt.nz> Sender: usenet@cs.qmw.ac.uk Lines: 43 Nntp-Posting-Host: whitesand In <18800.278d2d55@windy.dsir.govt.nz> sramtrc@windy.dsir.govt.nz writes: >I can write a short program using THINK C that takes up less than 1K of disk >space. That 1K program runs fine under A/UX. Yet if I compile and link that >program under A/UX for MacOS the program is 115K long. And it does exactly >the same thing as the 1K program. >Why does it take 114 K of code to get a 1K (actually the code of the actual >program can be just a few lines of assembler) program running? Is a copy >of launch built in with it as well? Try using things like "size" and "nm" to find out a) how much of the object file and final binary is actually code b) what modules from the various libraries are pulled in by your object file. You should look at the Makefiles for the /mac/src examples to make absolutely sure that you are using the shared versions of the mac libraries (one of the reasons for shared libraries is so that you can "send just the bits that the other people haven't got). >The REAL question is: Can I pluck out the few bytes that do the work and >stick them into a new file 1K long that runs just like the THINK version >of the program? I would have to pluck out the program code and the libmac.a >code that was in with it. Then stick all that into an "a.out" shell or >whatever the MacOS equivalent to COFF is. Sounds like you'd be better off sending a THINK application (1K) and the following executable shell script #!/bin/sh /mac/bin/launch thinkc_app Would someone from Apple care to offer any thoughts on "when to COFF and when not to COFF"? What are the circumstances which really require a COFF binary that uses the -lmac_s toolbox and for which a traditional Mac Application won't do? -- William Roberts ARPA: liam@cs.qmw.ac.uk Queen Mary & Westfield College UUCP: liam@qmw-cs.UUCP Mile End Road AppleLink: UK0087 LONDON, E1 4NS, UK Tel: 071-975 5250 (Fax: 081-980 6533)