Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!hao!oddjob!gargoyle!ihnp4!homxb!mtuxo!rolls!doug!tim From: tim@doug.UUCP (Tim J Ihde) Newsgroups: comp.lang.c Subject: Re: MSC Linking and Libraries Message-ID: <358@doug.UUCP> Date: Mon, 30-Nov-87 15:26:12 EST Article-I.D.: doug.358 Posted: Mon Nov 30 15:26:12 1987 Date-Received: Thu, 3-Dec-87 20:17:47 EST References: <3195@rosevax.Rosemount.COM> Organization: AT&T ISL - Somerset, NJ Lines: 35 Keywords: MSC Summary: a few answers In article <3195@rosevax.Rosemount.COM>, richw@rosevax.Rosemount.COM (Rich Wagenknecht) writes: > 1) Does the MSC linker link an entire library to an object file > or does it extract only the functions actually used by the > object code? If you are using a given function, then the entire .obj file that included that function will be included in your executable. The whole library is not included, but you still might get some functions that you don't need. For example, you might use printf and then find that the object code for scanf has been included in your executable even though you don't use it. For the most part, MicroSoft and other library vendors try to lump external functions/variables into one object module only if they are closely related - under the assumption that you will probably want the extraneous stuff as well. If you give the LIB program a filename to list to, it will produce a giant file telling which modules contain which functions. > 2) Why is the executable size of program so much larger > than the object file size? The De Smet compiler I've used seems to > produce much smaller executables than MSC. The executable contains a fair amount of code from the library just to start running, so it will always be bigger than your object code. The degree depends on how much startup work they do. It's doing things like allocating stack/heap space and whatnot. Plus you've got any library code you've used stuck in there someplace, this could easily be bigger than your object code all by itself. I'm not familier with DeSmet C, but it must do something similar. Perhaps they have broken their library modules down farther, so you end up with less unused object in the executable? tim