Link to home
Start Free TrialLog in
Avatar of mkd013
mkd013

asked on

DLL stack size in Visual C++

I have the following problem using  Visual C++ 4.0:
I first wrote my program as a console application (.exe). I use some fairly
large arrays as local vars in some functions, and       when i ran the .exe
 i got stack overflow messages. So i increased the stack size with the /STACK
linker option, and the routine worked.      
 
The problem is,  creating the .exe is just the first stage, to check if the
routine works. Once it does, i turn it into a DLL, because i want to invoke
a function from another Windows application . But with the DLL i can't use
the /STACK option, because ( according to the online help) it applies only to
executable files. So  invoking the routine makes the calling application burst.
 
There is another _compiler_, not linker, option that's supposed to increase
stack size:  /F , but it doesn't seem to work . Not only with the DLL, but with
the .exe as well. (specifying /F  without /STACK ==> stack overflow).
 
So, am I doing something wrong? Or should I do something else to increase stack
size??
 
All this under WinNT 4.0 .
ASKER CERTIFIED SOLUTION
Avatar of tovergaard
tovergaard

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cotthemh
cotthemh

I have a similar problem, yet increasing the stack size in the DLL did not help.  I am using a visualisation in the windows media player and the following test pseudo code

void tests (int s)
{
  >>show S
  test(s+1);
}

crashes at a stack size of about 2800 recursive calls.

My real routine is quite a complex tree recursion program, so if you found a solution it would be nice