Solved

DLL stack size in Visual C++

Posted on 1997-08-20
2
1,691 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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now