用c在C#应用程序堆栈溢出++ DLL [英] Stack overflow in c# app using c++ dll

查看:281
本文介绍了用c在C#应用程序堆栈溢出++ DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经得到了它使用的是C ++ / CLI托管DLL C#程序。这个DLL中包含了大量的遗留代码,其中包括相当一部分的Win32窗口。

I've got a c# program which is using a c++/cli managed dll. The dll contains a lot of legacy code, consisting of quite a few win32 windows.

但问题是,在DLL中的窗口需要比平均水平多一点stackspace的咳嗽的。由于这些都不是后台进程,但Win32 API的我需要放大GUI线程的堆栈大小(至少我认为在DLL中的Win32 API将使用主要的GUI程序)。

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

所以,我需要一种方法来扩大在交流过程中#GUI线程的大小。

So I need a way to enlarge the size of the GUI thread in a c# process.

由于我没有发现任何设置,以实现这个我试过EDITBIN / STACK命令行,它的工作原理。问题是,它只能在命令行中,如果我尝试进入它如因某种原因二进制的堆栈大小不会改变生成后步,即使postbuild步骤正确执行并抛出任何错误:(

Since I found no settings to achieve this I tried editbin /STACK from the command line, which works. Problem is, it only works in the command line, if I try to enter it as post-build-step for some reason the stack size of the binary does not change, even though the postbuild step is properly executed and throws no error :(

editbin.exe /STACK:2097152 $(TargetPath)

(Editbin.exe是路径,并且在输出窗口没有错误)

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

那么,如何我会得到更多的堆栈大小为我的C ++ DLL?

So how do I get more stack size for my c++ dll?

[更新]

我注意到使用EDITBIN问题。.EXE

I noticed a problem using editbin.exe.

这是不行的,无论是在命令行也不作为后生成步骤:

This does not work, neither in command line nor as post build step:

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

这不会在命令行工作,但不能作为构建步骤:

This does work in command line, but not as build step:

editbin.exe /STACK:2097152 app.exe

但我需要它作为后生成步骤的工作我。试图把它变成一个批处理文件,回显的,以确保通话和工作目录都OK,但它仍然无法正常工作。奇怪的。

But I need it to work as post build step. I tried to put it into a batch file, echo'd to make sure call and working dir are ok, but still it does not work. Strange.

推荐答案

这不应该工作,奇怪的是,你没有得到生成错误。路径设置不正确,能够在C#编译使用的工具。它的命令行工作时,Visual Studio命令提示符使用配置了C / C ++项目。此版本后命令在VS2008正常工作:

This shouldn't work, odd that you don't get a build error. The path isn't set correctly to be able to use the tool in a C# build. It does work from the command line, the Visual Studio Command Prompt uses the config for a C/C++ project. This post-build command worked properly in VS2008:

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

另外要注意周围的目标路径宏来处理空间的双引号。

Also note the double-quotes around the target path macro to deal with spaces.

这篇关于用c在C#应用程序堆栈溢出++ DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆