Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rutgers!psuvax1!psuvm!cunyvm!ndsuvm1!mtus5!ythnmadd From: YTHNMADD@MTUS5.BITNET (Noel Maddy) Newsgroups: comp.lang.pascal Subject: Re: Problem with constants in Turbo Pascal unit Message-ID: <90097.161958YTHNMADD@MTUS5.BITNET> Date: 7 Apr 90 21:19:58 GMT References: <90096.105600TBC101@psuvm.psu.edu> Organization: Computing Technology Services, Michigan Technological Univ. Lines: 38 Tom "Shark" Collins writes: > I'm having a problem with Turbo Pascal 5.5 and it's inclusion of > constants in my programs. I have a unit (Fonts) that contains 12 > constants (arrays 4k in size). When I just have 'Uses Fonts' in one of > my programs, everything is ok, it doesn't link the fonts. If I use any > reference to just one of the fonts, all are included in the compiled > program. My questions are 'Why?' and 'How do I get Turbo to not include > fonts not used?' > > -- > Tom "Shark" Collins Since ICS is comprised of 2 people, my views > tbc101@psuvm.psu.edu are the opinion of at least 50% of the company. In Turbo Pascal 5.0 (and, I would assume, 5.5), unused data is only removed on a "per declaration section basis." In other words, if you declare const Font1 = ...; Font2 = ...; and use either constant, Turbo will link both. The way to get around this is to make each constant a separate declaration section in your unit: const Font1 = ...; const Font2 = ...; Not very intuitive, but it works! -- Noel Maddy Bitnet: ythnmadd@mtus5 'Only by counting could humans Snail: 210 Vivian demonstrate their independence Hancock, MI 49930 of computers' - THGttG