Solved

DLL stack size in Visual C++

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Visual Studio C# project complains it can't run a dll 5 106
What is sub-make ? 2 71
Resolve Dependency Issues 4 79
windows 10 pro lost profile. 10 44
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
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…
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.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

861 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