Thread View: comp.sys.ibm.pc.programmer
3 messages
3 total messages
Started by Richard Sitze
Tue, 29 May 1990 16:19
MS LINK & MSC5.1 problems
Author: Richard Sitze
Date: Tue, 29 May 1990 16:19
Date: Tue, 29 May 1990 16:19
45 lines
1798 bytes
1798 bytes
I'm getting
LINK : error L2041: stack plus data exceed 64K
for a program writting in Microsoft C 5.1. The program consists of a large
number of seperate object files & libraries. The object files have all
been compiled with the following flags:
/Zl /W3 /Oailsp /AL /J # optimizations, large model
I've also tried (for the object files but not the libraries):
/Zl /W3 /Oailsp /AL /Aw /J
in an attempt to locate the stack segment by itself. I'm not sure I
correctly understand the purpose of the /Aw flag.. The files are all linked
with the following flags to the linker:
/NOI /F /PAC /ST:8196
So, the questions are:
1) anyway to convince the linker to create a seperate stack segment?
2) any nice easy fix to this?
3) any difficult fix to this?
4) any helpful/constructive comments of any sort?
I'm stumped, tired, frustrated, and going home. Any help would be
greatly appreciated. BTW, please ignore the 'path' and 'from'
field in the header, they are the result of a screwy system here
on campus. I'm quite able to read news, but any email should be
sent to
sitze@nmsu.edu
Thanks in advance,
<ras>
--
+--------------------------------------+
| Richard A. Sitze |
| sitze@nmsu.edu phone: 646-6228 |
+--------------------------------------+
Re: MS LINK & MSC5.1 problems
Author: John Eras
Date: Sun, 10 Jun 1990 03:07
Date: Sun, 10 Jun 1990 03:07
43 lines
2403 bytes
2403 bytes
In article <SITZE.90May29101947@teewi.nmsu.edu> sitze@nmsu.edu (Richard Sitze) writes:
>
>I'm getting
>
>LINK : error L2041: stack plus data exceed 64K
>
>for a program writting in Microsoft C 5.1. The program consists of a large
>number of seperate object files & libraries. The object files have all
>been compiled with the following flags:
>
> /Zl /W3 /Oailsp /AL /J # optimizations, large model
>
>I've also tried (for the object files but not the libraries):
>
> /Zl /W3 /Oailsp /AL /Aw /J
>
>in an attempt to locate the stack segment by itself. I'm not sure I
>correctly understand the purpose of the /Aw flag.. The files are all linked
>with the following flags to the linker:
>
> /NOI /F /PAC /ST:8196
I see this question fairly regularly. The fix is trivial, and does not involve
moving the stack into its own segment. (You want separate stack and data
segments? With msc 5.1? Ha ha ha ha ha ha ha ha ha ha!)
The fix is this:
o Compile with a low(er) -Gt size. This sets the threshhold for the size
of objects which will be allowed into the default data segment; larger
objects will be put into far data segments. This is especially
important, as it leaves space in the DS/SS segment for your stack by
moving data out. The default -Gt is something like 32767 or some other
equally huge-mongous number.
o Link with /PACKCODE (/FAR), and /PACKDATA if your linker has it, if you
need to. This is just to cut down on the number of segments used, since
lots of segments will invariably be used with low -Gt settings.
Um, that oughtta do it.
----------------------- (: smile! you're on usenet! :) ------------------------
AT: jeras@oracle.com | "It's a terrible waste
BANG: ...{pacbell,hplabs,apple,decwrl}!oracle!jeras | to lose one's .sig, or
FLAME: /dev/null (nyuk, nyuk) | not to have one at all."
Re: MS LINK & MSC5.1 problems
Author: Robert McGwier
Date: Mon, 11 Jun 1990 15:56
Date: Mon, 11 Jun 1990 15:56
25 lines
1227 bytes
1227 bytes
From article <SITZE.90May29101947@teewi.nmsu.edu>, by sitze@nmsu.edu (Richard Sitze):
>
> I'm getting
>
> LINK : error L2041: stack plus data exceed 64K
>
Richard:
Do you REALLY need these big variables to be local variables. I would
malloc these large arrays (fmalloc if you are using a small model) thse
variables off the far heap and then your stack overflow problems should
goi away. You just can't get more than 64K out of a single segment,
which is what you get when you set SS. USE MALLOC, THIS IS WHAT IT IS
FOR!
Hope this helps.
Bob
--
____________________________________________________________________________
My opinions are my own no matter | Robert W. McGwier, N4HY
who I work for! ;-) | CCR, AMSAT, etc.
----------------------------------------------------------------------------
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads