[ Usenet FAQs | Web FAQs | Documents | RFC Index ]
    Search the FAQ Archives

Part1 - Part2 - Part3 - Part4 - Part5 - Single Page

Top Document: comp.os.msdos.programmer FAQ part 2/5
Previous Document: - What the heck is DGROUP > 64K?
Next Document: - Will Borland C code and Microsoft C code link together?


- How do I fix 'automatic data segment exceeds 64K' or 'stack plus data exceed 64K'?


Date: 5 Feb 2002 22:03:03 -0400

 These messages are a variation of "DGROUP > 64K". For causes, please see
 the preceding question.

 If you get this error in tiny model, your program is simply too big and
 you must use a different memory model. If you get this link error in
 models small, compact, medium, large, or Microsoft's huge, there are
 some things you can do. (This error can't occur in Borland's huge
 model.)

 If you have one or two big global arrays, simply declare them far. The
 compiler takes this to mean that any references to them will use 32-bit
 pointers, so they'll be in separate segments and no longer part of
 DGROUP.

 Or you can use the /Gt[number] option with Microsoft or - Ff[=size] with
 Borland C++ 2.0 and up. This will automatically put variables above a
 certain size into their own segments outside of DGROUP.

 Yet another option is to change global arrays to far pointers. Then at
 the beginning of your program, allocate them from the far heap
 (_fmalloc() in Microsoft, farmalloc() in Borland).

 Finally, you can change to huge model (with Borland compilers, not
 Microsoft). Borland's H model still uses far pointers by default, but
 "sets aside the [64K] limit" and has no DGROUP group, according to the
 BC++ 2.0 Programmer's Guide. Microsoft's H model does use huge data
 pointers by default but retains DGROUP and its 64K limit, so switching
 to the huge model doesn't buy you anything if you have DGROUP problems.



Top Document: comp.os.msdos.programmer FAQ part 2/5
Previous Document: - What the heck is DGROUP > 64K?
Next Document: - Will Borland C code and Microsoft C code link together?

Part1 - Part2 - Part3 - Part4 - Part5 - Single Page


[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
jeffrey@carlyle.org (Jeffrey Carlyle)

Last Update October 22 2009 @ 05:28 AM

Some parts © 2009 Advameg, Inc.