?
Solved

DLL stack size in Visual C++

Posted on 1997-08-20
2
Medium Priority
?
1,793 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 100 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them 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.
Suggested Courses

864 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