home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!math.fu-berlin.de!informatik.tu-muenchen.de!rz.uni-passau.de!hiwi170.rz.uni-passau.de!schmidt
- From: schmidt@rz.uni-passau.de (SCHMIDT GUIDO)
- Newsgroups: comp.lang.c++
- Subject: Re: DOS, BC++, Need, large data memory, how?
- Date: Sat, 23 Jan 1993 14:10:12 GMT
- Organization: University of Passau - Germany
- Lines: 51
- Message-ID: <schmidt.31@rz.uni-passau.de>
- References: <80362@hydra.gatech.EDU> <schmidt.21@rz.uni-passau.de> <RUNE.93Jan22073636@calypso.nta.no>
- NNTP-Posting-Host: hiwi170.rz.uni-passau.de
-
- In article <RUNE.93Jan22073636@calypso.nta.no> rune@nta.no (Rune Henning Johansen FBA) writes:
-
-
- > > I've tried the following program with TCW 3.0 in model SMALL. It works fine.
-
- >Thanks for the program! I didn't know about "farmalloc" before. But
- >my problem is that I'm not able to link my program. (I should have
- >specified that, sorry!) When I'm able to run my program, I guess
- >"farmalloc" will be very useful in a redefined "new", but until then:
- >How can I link my program without getting: "Automatic data segment
- >exceeds 64K"?
-
- > - Rune
-
-
-
- Hello!
-
- Since you use TCW as far as I understood your questions you can only use
- model LARGE as the biggest one. This gives you only 64k for the automatic
- data segment per .cpp file. In the automatic data segment you find (as the
- name says) automatic data. I.e. variables which are local to a function and
- are not static. See the following example:
-
- void anyfunction() {
- char largearray[50000]; // <-- automatic data
- ...
- largearray[1000] = 'A';
- ...
- }
-
- You can get around this by using the heap/farheap with new, malloc or
- farmalloc. In the above example:
-
- void anyfunction() {
- char * largearray; // <-- takes only 2 or 4 bytes
- largearray = new char[50000]; // 50000 bytes taken from heap
- ...
- largearray*[1000] = 'A'; // I'm not quite sure about
- // this one
- ...
- delete largearray; // free 50000 bytes from heap
- }
-
- Guido.
- --------------------------------------------------------------------
- - Guido Schmidt -
- - schmidt@rz.uni-passau.de -
- - Universitaet Passau, Germany -
- --------------------------------------------------------------------
-
-