Xref: utzoo comp.software-eng:2622 comp.misc:7592 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!think!snorkelwacker!bloom-beacon!eru!luth!sunic!enea!sommar From: sommar@enea.se (Erland Sommarskog) Newsgroups: comp.software-eng,comp.misc Subject: Linkers Message-ID: <530@enea.se> Date: 6 Dec 89 21:35:15 GMT References: <9185@hoptoad.uucp> Organization: Enea Data AB, Sweden Lines: 44 Tim Maroney (tim@hoptoad.UUCP) writes: >WHAT? What year is this? I don't think I've ever used a linker that >didn't eliminate unused routines. Any such linker would be seriously >brain damaged. While this may seem credible at first glance, it is at not second. I am very happy that the linker we use in our project (VMS LINK) don't remove uncalled routines. In that case it would notice that this routine is never called, and never is this one and so forth and rapidly it would have removed the 250 top modules. In the next step it would remove modules they call etc, and instead of giving us the 10500 block executeable we want, it would leaves a tiny thing on 100-200 blocks. The trick is in Cobol where you can say Routine PIC x(32). ... CALL Routine USING.... Routine is not a literal, it is a string variable. All top entries corresponds to menu choices. When the user enters a menu choice, it is looked up in a database, which gives you the name of the procedure to call. Then of course there are other reasons why may want uncalled routines to be included in the final image. Debugging is one. As been pointed out by other posters, most linkers include all object files you feed it with - and that's probably the behaviour you want - but from libraries it only includes referenced modules, and those you particulary ask for. I don't know about Unix linker, but the VMS linker takes the entire object module, even if only one routine in it is called. This may seem stupid, but if the linker should be able to pick out pieces it would have to analyze the object module to see exactly which routines the referenced routine called, both inside and outside the object module. However, the language processor may help the linker. VAX-Cobol makes a separate module of each procedure. I don't know about VAX-C, but I would guess that one file gives one object module, although one could envision the opposite with a separate object module for variables on file level. (Or, couldn't one. Don't flame me, I don't speak C.) -- Erland Sommarskog - ENEA Data, Stockholm - sommar@enea.se Mail me your votes on comp.lang.cobol.