Article View: comp.lang.pascal.ansi-iso
Article #30Re: ## HELP ## with Turbo Pascal 7.0 (Compiler Error 49)
From: Peter Knoerrich
Date: Mon, 24 Jun 1996 00:00
Date: Mon, 24 Jun 1996 00:00
63 lines
3088 bytes
3088 bytes
sv_sw@kiruna.se (sv) writes: >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. > >Doug Turbo Pascal will only handle 64kB of global variables in the data segment (that's everything outside any function from all the units plus the main program file). You can however sometimes use some STACK space for temporary larger data structures and variables: Try to move your larger buffers from global definitions to local ones. Local variables go to a separate 64kB stack segment and also stop taking up space once the procedure defining them ends. type BIGTYPE = array[0..10000] of integer; var BIG : BIGTYPE; procedure berk; begin /* BIG used here */ end; vs. type BIGTYPE = array[0..10000] of integer; /* doesn't take space so stays */ procure berk; var BIG : BIGTYPE; /* Goes to the stack now */ begin /* BIG used here */ end; You'll probably need to pass references to BIG to procedures called by berk if they need to access BIG: procedure called_by_berk(var BIG : BIGTYPE); This allows for up to another 64kB of data. Last resort is pointers. For variables which don't change their size that can be pretty simple though: type BIGTYPE = array[0..10000] of integer; var BIG : ^BIGTYPE; begin /* of main program */ New(BIG,sizeof(BIGTYPE)); /* Oh gosh I hope this works - no help online here! */ /* Now, where you used BIG before, use BIG^ . */ Dispose(BIG); /* optional cleaning up. Makeup. DON'T use BIG^ afterwards. */ end; Hmm, if it don't work ask again, I'll check with TP help then. Boy you'd not think memory fades that fast. Peter.
Technical Details
Message-ID:
<4qn2mi$9g2@rznews.rrze.uni-erlangen.de>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<4q7enr$6t7@ddi2.digital.net> <4qf9gv$km2@henrietta.kiruna.se>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: 10c950,705188ec19b8262f X-Google-Attributes: gid10c950,public X-Google-Thread: 102601,705188ec19b8262f X-Google-Attributes: gid102601,public X-Google-Thread: 111659,705188ec19b8262f X-Google-Attributes: gid111659,public X-Google-Thread: 10d4ef,705188ec19b8262f X-Google-Attributes: gid10d4ef,public X-Google-Thread: 10261c,705188ec19b8262f X-Google-Attributes: gid10261c,public X-Google-Thread: 102bfa,705188ec19b8262f X-Google-Attributes: gid102bfa,public From: prknoerr@cip.informatik.uni-erlangen.de (Peter Knoerrich) Subject: Re: ## HELP ## with Turbo Pascal 7.0 (Compiler Error 49) Date: 1996/06/24 Message-ID: <4qn2mi$9g2@rznews.rrze.uni-erlangen.de> X-Deja-AN: 161916247 references: <4q7enr$6t7@ddi2.digital.net> <4qf9gv$km2@henrietta.kiruna.se> organization: Student Pool, CSD., University of Erlangen 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