Microsoft KB Archive/46996
Article ID: 46996
Article Last Modified on 9/30/2003
- Microsoft LINK for MS-DOS 4.x
- Microsoft LINK for MS-DOS 5.03
- Microsoft LINK for MS-DOS 5.05
- Microsoft LINK for MS-DOS 5.1
- Microsoft LINK for MS-DOS 5.11
- Microsoft LINK for MS-DOS 5.13
- Microsoft LINK for MS-DOS 5.15
- Microsoft LINK for MS-DOS 5.3
- Microsoft LINK for MS-DOS 5.31.009
- Microsoft LINK for MS-DOS 5.5
- Microsoft LINK for MS-DOS 5.6
This article was previously published under Q46996
An attempt to link an application fails and Microsoft LINK generates the following message:
The size of the DGROUP segment (the default data segment) exceeds 64K.
There are four methods to resolve the data segment overflow with Microsoft C and Microsoft QuickC, as follows:
- Specify a smaller value for the stack size.
- In the QuickC environment, choose Make from the Options menu, choose Linker Flags, and choose Stack Size.
- In the Programmer's WorkBench (PWB) environment, choose Link Options from the Options menu, then choose Stack Size.
- On the LINK command line, specify the /ST:decnum option switch, where "decnum" is the size of the requested stack as a decimal number.
- On the C command line, specify the /F hexnum option switch, where "hexnum" is the size of the requested stack as a hexadecimal number.
- Specify the FAR keyword for data declarations to remove the data from DGROUP.
Note: In the small and medium memory models, functions of the Microsoft run-time libraries cannot access data removed from DGROUP in this manner. The application must copy the far data to a near heap location before using a run-time library routine with this data.
- Compile the application in the compact, large, or huge memory model and specify the /GtX compiler option switch where "X" is the data threshold in decimal format. Any data item larger than "X" bytes is removed from DGROUP into a far data segment.
Note: In QuickC version 2.5 and in PWB versions 1.0 and later, it is not necessary to leave the environment. Specify the /Gt option switch in the Additional Options field for the compiler.
- Reduce the amount of data declared in the program. In an application developed for the compact, large, or huge memory models, try dynamically allocating space for the data. In the small and medium memory models, you can use _fmalloc() to dynamically allocate memory outside DGROUP; however, as stated in method number 2 above, the run-time libraries do not work with this data.
Reduce the amount of string literals in the default data segment by reading strings from a data file at run time, or, in C version 5.0, by specifying the /Gt option switch to move string literals form the _CONST segment in DGROUP into a far segment.
Additional query words: 2.50 4.10 5.00 5.10 5.30 5.50 5.60
Keywords: kb16bitonly KB46996