Stack overflow in C # application using C ++ dll

I have a C # program that uses a C ++ / cli dll. The dll contains a lot of legacy code consisting of several win32 windows.

The problem is that windows in the dll require a bit more stacks than an average cough. Since these are not background processes, but win32 api, I need to increase the stack size of the GUI thread (at least I think win32 api in the dll will use the main gui process).

So, I need a way to increase the size of the GUI thread in a C # process.

Since I did not find any settings for this, I tried editbin / STACK from the command line, which works. The problem is that it only works on the command line, if I try to enter it as a post-assembly, for some reason the size of the binary file stack will not change, although the postbuild step is executed correctly and does not throw an error :(

editbin.exe /STACK:2097152 $(TargetPath) 

(Editbin.exe is in the path and there is no error in the output window)

So, how do I get a larger stack size for my C ++ dll?

[Update]

I noticed a problem using editbin.exe.

This does not work, either on the command line or in the post build step:

 editbin.exe /STACK:2097152 c:\some\path\bin\release\app.exe 

This works on the command line, but not as a build step:

 editbin.exe /STACK:2097152 app.exe 

But I need it to work as a post build step. I tried putting it in a batch file, echo'd, to make sure the call and working directory were ok, but it still doesn't work. It’s strange.

+4
c # stack-overflow dll c ++ - cli
Apr 04 2018-11-12T00:
source share
2 answers

This should not work, it is strange that you are not getting a build error. The path is not set correctly to use the tool in a C # assembly. It works from the command line, Visual Studio Command Prompt uses the configuration for the C / C ++ project. This post build command worked correctly in VS2008:

 set path=%path%;$(DevEnvDir);$(DevEnvDir)..\..\vc\bin editbin.exe /STACK:2097152 "$(TargetPath)" 

Also note the double quotation marks around the target path macro for handling spaces.

+8
Apr 05 '11 at 3:27
source share

Does it help? / F (Set stack size)

This basically provides the / F switch along with the number of bytes you want to reserve for the stack.

-one
Apr 04 '11 at 12:40
source share



All Articles