Path: utzoo!utgpu!water!watmath!clyde!att!pacbell!ames!mailrus!husc6!bloom-beacon!bu-cs!dartvax!eleazar.dartmouth.edu!earleh From: earleh@eleazar.dartmouth.edu (Earle R. Horton) Newsgroups: comp.sys.mac.programmer Subject: Toolmaker's tip for MPW. Keywords: Link with stubs. Message-ID: <8559@dartvax.Dartmouth.EDU> Date: 24 May 88 16:56:45 GMT Sender: news@dartvax.Dartmouth.EDU Reply-To: earleh@eleazar.dartmouth.edu (Earle R. Horton) Organization: Dartmouth College, Hanover, NH Lines: 29 When linking MPW tools, use of stubs.c (C) or stubs.a (Pascal) can lead to substantial reductions in code size of the linked tool. These files are on the compiler distribution disks, in the example program folders. They provide dummy functions for routines which are used by applications, but never by tools. It is helpful to compile the stubs sources and place the .o files in the appropriate library folder. The linker doesn't like the duplicate names, so you have to use the -w flag when linking to prevent your worksheet from filling up with error messages. Link the stubs file before any library files used by the tool. Read '\' as 'option-d' in the following link example: # Link C object files into an MPW Tool using stubs.c.o Link -w -b -c 'MPS ' -t MPST \ "{CLibraries}"stubs.c.o \ "{CLibraries}"CRuntime.o \ "{CLibraries}"StdCLib.o \ "{CLibraries}"CSANELib.o \ "{CLibraries}"CInterface.o \ "{Libraries}"Interface.o \ {YOUR_OBJECT_FILES} -o {YOUR_TOOL_NAME} I am prompted to make this posting because I have received MPW Makefiles which indicate the author either didn't look closely at the example Makefile provided for a Tool, or forgot what he saw there. ToolMaker's tip #2: read example programs! ********************************************************************* *Earle R. Horton, H.B. 8000, Dartmouth College, Hanover, NH 03755 * *********************************************************************