Article View: comp.lang.pascal.ansi-iso
Article #28Re: ## HELP ## with Turbo Pascal 7.0 (Compiler Error 49)
From: Mike Copeland
Date: Wed, 19 Jun 1996 00:00
Date: Wed, 19 Jun 1996 00:00
42 lines
3559 bytes
3559 bytes
> > During compile, I am getting error 49 Data Segment to large. > > In my Uses section of my program I have the following: > > > > Uses dos,crt,support,menubox,objects; > > > > The latter 3 are my tpu's. > > > > In help, it says to create a pointer to objects to lower the > > data segment or something. If anyone understands how to > > correct this problem or my spelling I would sure appreceate it. > > > I don't know which model are you using. If you are not using HUGE model, > try to use it. There is no declaration of Model in TP/BP - I believe that's only for C/C++ - and that's not an appropriate solution to his problem. This error, all too common for new Pascal programmers, is caused by the programmer declaring too much Var data within the total components of his/her program: main program _and_ Units. TP/BP limits the target program to 64K of Var data (the Data Segment), and the solution to this error only involves reducing the Var data which is used/bound into the target program. There are many ways to do so: - Reduce the size of large data structures, such as arrays, records, strings (use specific-size strings, rarher than "string"), etc. - Create multiple Var blocks in Units, so that the Smart Linker won't link _all_ of the Unit data, even though it's not referenced bny the program. This invaluable step requires analysis of the applications which use the Unit, so that data is organized in a fashion associated with the using programs. This process can significantly reduce the amount of Var data linked into any given program...and should always be done for "global" Units. TP/BP Smart Linking will bind into the target program only _referenced_ subprograms and data, so the total amount of subprograms and global data in a Unit can be enormous, so long as the S/L has a way to exclude components which aren't referenced by a program or another Unit. - Declare some procedure-local data in the subprogram code, so that such data is allocated on the Stack, rather than on the Data Segment. - Use Pascal pointers to reference large data structures, and allocate that data on the Heap. This is the most commonly recommended solution, but it requires knowledge of and experience with Pascal pointers (something which should be done in any case...).
Technical Details
Message-ID:
<31C81B26.4C72@primenet.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<4q7enr$6t7@ddi2.digital.net> <31C7F4D0.3EA2@asiaonline.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10f6aa,705188ec19b8262f X-Google-Attributes: gid10f6aa,public X-Google-Thread: 102601,705188ec19b8262f X-Google-Attributes: gid102601,public X-Google-Thread: 10d4ef,705188ec19b8262f X-Google-Attributes: gid10d4ef,public X-Google-Thread: 102bfa,705188ec19b8262f X-Google-Attributes: gid102bfa,public X-Google-Thread: 111659,705188ec19b8262f X-Google-Attributes: gid111659,public X-Google-Thread: 10c950,705188ec19b8262f X-Google-Attributes: gid10c950,public X-Google-Thread: 10261c,705188ec19b8262f X-Google-Attributes: gid10261c,public From: Mike Copeland <mrcope@primenet.com> Subject: Re: ## HELP ## with Turbo Pascal 7.0 (Compiler Error 49) Date: 1996/06/19 Message-ID: <31C81B26.4C72@primenet.com> X-Deja-AN: 161031468 references: <4q7enr$6t7@ddi2.digital.net> <31C7F4D0.3EA2@asiaonline.net> content-type: text/plain; charset=us-ascii organization: Primenet mime-version: 1.0 x-posted-by: ip176.phx.primenet.com newsgroups: comp.lang.pascal.ansi-iso,alt.msdos.programmer,comp.lang.pascal.borland,comp.lang.pascal.misc,comp.os.msdos.programmer,comp.programmer,ctdl.lang.pascal x-mailer: Mozilla 2.02 (Win16; I)