Solved

DLL stack size in Visual C++

Posted on 1997-08-20
2
1,702 Views
Last Modified: 2013-12-14
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 .
0
Comment
Question by:mkd013
2 Comments
 
LVL 2

Accepted Solution

by:
tovergaard earned 50 total points
ID: 1253437
When you make a DLL you must set the stack size in the .def file (the file should be included in your project, I can't remember if Visual C++ have a default .def file, but in all cases it is good practice to make your own .def file.

You can set the stacksize and a lot other usefull things.


0
 

Expert Comment

by:cotthemh
ID: 7873673
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
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question