Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!comp.vuw.ac.nz!windy!sramtrc From: sramtrc@windy.dsir.govt.nz Newsgroups: comp.unix.aux Subject: Why is this one line program SOOOO LOOOOOONNNNNNNNGGGGGGGG? Message-ID: <18800.278d2d55@windy.dsir.govt.nz> Date: 11 Jan 91 03:13:25 GMT Reply-To: sramtrc@albert.dsir.govt.nz Organization: DSIR, Wellington, New Zealand Lines: 47 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? 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. Do I hear you say that THINK C strips its executables? OK so when I strip my A/UX program it goes down to 75K. Still a huge amount of stuff. I can reduce it to 45K using shared libraries but THINK C doesn't use shared libraries so that's not a valid comparison. It makes sense to not distribute complete applications written under A/UX for MacOS using electronic methods. If you send out a 15K program you would also have to send 45K of stuff that everyone has anyway. Better to just send the 15K object file and let users link it themselves. This is not an important issue. I'm just curious what all that extra baggage is. And since it is unnecessary I would like to see it "unlinked" from my program and just temporarily used at runtime or something. I wonder if I can make a shared library out of it. I have written a utility (it's for MacOS running on top of UNIX only - it uses MacOS and A/UX calls all over the place). It is 15K long and compresses into 7K - small enough to post as a message in this newsgroup. But not small enough if I include the baggage. So I was wondering whether or not to post the whole application or just the object file. Cheers, Tony Cooper sramtrc@albert.dsir.govt.nz I wonder how you write a setuid INIT or FKEY or whatever. Maybe the init would just do one thing - exec a setuid program. Hmmmm. If the program the INIT exec'ed was an A/UX program the one line INIT would be longer than the program it exec'ed. PS I hope Apple have a good upgrade policy for owners of earliers versions of that X stuff. Like I hope that the upgrade 2.0 -> 2.01 is inexpensive.