Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: smart linker Message-ID: <15279@smoke.brl.mil> Date: 21 Feb 91 21:11:55 GMT References: <1991Feb21.102123.9868@cs.umn.edu> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 18 In article <1991Feb21.102123.9868@cs.umn.edu> swie@cs.umn.edu (S. T. Tan) writes: >Is there a C compiler bundled with a "smart linker" for DOS? >What I meant by a smart linker is the linker which will only link and include >those routines which are referenced in the main program, and all of the >remaining unused routines are ignored so that the size of the excutable file >can be reduced. While I'm not aware of the characteristics of MS-DOS C offerings, I feel I should point out that the selective linking must be done on the basis of OBJECT MODULE, not FUNCTION. (An object module would be the linkable unit produced by compiling one "translation unit" [in C standard parlance].) Generally in the UNIX world linkers do act that way and also do not include in the image any object modules from libraries except when they are needed to satisfy external references. With a minor amount of assistance from the compiler, it is even possible to exploit this behavior to exclude floating-point support from printf() when there has been no use of floating-point in the program being linked.