Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site k.cs.cmu.edu Path: utzoo!watmath!clyde!bonnie!akgua!gatech!seismo!rochester!pt.cs.cmu.edu!k.cs.cmu.edu!tim From: tim@k.cs.cmu.edu (Tim Maroney) Newsgroups: net.micro.mac Subject: Re: Using the Macintosh Toolbox with C (toolbox glue) Message-ID: <687@k.cs.cmu.edu> Date: Sun, 1-Dec-85 05:02:32 EST Article-I.D.: k.687 Posted: Sun Dec 1 05:02:32 1985 Date-Received: Tue, 3-Dec-85 08:46:09 EST References: <1067@lll-crg.ARpA> Organization: Carnegie-Mellon University, Networking Lines: 32 Two approaches to Macintosh toolbox interfaces for C compilers were mentioned. The summary was fairly good, so I'll just reprint it: > Approach 1: Smart Compiler - Consulair (and Aztec) have built the > necessary smarts into their compilers to generate the correct > linkage to each of the 400 or so traps. This of course leads to a > larger somewhat slower compiler than the following... > > Approach 2: Glue - MegaMax and the SUmacc systems take the opposite > approach of hiding all of the linkage routines in object libraries. > So instead of calling the trap directly, the call is routed through > a tiny routine which sets up the stack/registers appropriately for > the Toolbox call. This makes for an ultrafast compiler but leads to > long link times since the Glue must be attached by the Linker. For some reason, Dave avoided getting into comparisons of these approaches, and in fact seemed to imply they were equally good. To me, the issue seems very clear cut: the smart compiler approach is far better. You have to consider the different effective costs of compile-time memory and speed, and run-time memory and speed. It is better to have 10K of additional space in a compiler (to generate smart toolbox interfaces) than 2K of additional space in hundreds of programs generated by that compiler (for machine code of glue routines). It is better to use an extra few minutes in a compiler (for generation of smart interfaces) than a few extra seconds in hundreds of thousands of executions of programs generated by the compiler (for executing the glue routines). Space and memory are far cheaper at compile time than at run time, because code will be compiled far less frequently than it is run. Using intelligently-generated interfaces is a major win. -=- Tim Maroney, Electronic Village Idiot, CMU Center for Art and Technology tim@k.cs.cmu.edu | uucp: {seismo,decwrl,ucbvax,etc.}!k.cs.cmu.edu!tim CompuServe: 74176,1360 | CMU. Tomorrow's networking nightmares -- today!