skibud2
asked on
Stack Overflow Problem
I wrote a dll that needs a pretty large stack. I am getting constact stack overflow problems. How can I increase the stack size? This is a Win32 dll.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
A DLL does not have a stack of its own. Rather any stack space used in a DLL is that from the "owning" application.
If you need to increase the stack space, you do that via a linker option. Use the /STACK option or follow the instructions here as quoted from the SDK docs:
/STACK (Stack Allocations)
Home | Overview | How Do I | Linker Options
The Stack Allocations (/STACK:reserve[,commit]) option sets the size of the stack in bytes.
To find this option in the development environment, click Settings on the Project menu. Then click the Link tab, and click Output in the Category box. The Reserve text box (or in the reserve argument on the command line) specifies the total stack allocation in virtual memory. The default stack size is 1 MB. The linker rounds up the specified value to the nearest 4 bytes.
If you need to increase the stack space, you do that via a linker option. Use the /STACK option or follow the instructions here as quoted from the SDK docs:
/STACK (Stack Allocations)
Home | Overview | How Do I | Linker Options
The Stack Allocations (/STACK:reserve[,commit]) option sets the size of the stack in bytes.
To find this option in the development environment, click Settings on the Project menu. Then click the Link tab, and click Output in the Category box. The Reserve text box (or in the reserve argument on the command line) specifies the total stack allocation in virtual memory. The default stack size is 1 MB. The linker rounds up the specified value to the nearest 4 bytes.
ASKER
short myArray[9000000]={1};
I have tried setting the \STACK:32 command for the project settings.