I have a simulation engine written in Visual C++ 2010 and I'm implementing a DLL plugin based on it for another 3rd party application.
However, I get a stack overflow error when my library is called by the 3rd party app's thread. After debugging it turned out that the DLL requires a bigger stack size than the thread has. Is it possible to extend the current thread's stack size somehow?
I know I should probably review the simulation engine's code and move big objects to the heap. The problem is that the engine is maintained by another vendor and I'd like to avoid modifying their code if possible.
I'm thinking about creating my own thread in the DLL with a bigger stack size and returning the results to the calling thread when the calculation finishes. Is it the right approach?
Thanks, Michal
You can check and increase reserved stack size of the main executable. Just open the Command Prompt for VS (I have VS 2019 installed and it is called "Developer Command Prompt for VS 2019"), navigate to the main application's folder and type:
where N - stack size in bytes (e.g. if you want 4MB type 4194304).
Worked for me.