关闭 Visual Studio 中的运行时检查
我遇到的问题是,由于将太大的数字转换为较小的类型,在 Visual C++ 2008 中运行时检查失败。 故障发生在外部 dll 中,因此我无法在那里修复它。 那么我怎样才能关闭外部项目的运行时检查呢?
I have the problem, to get a failed run-time check in Visual C++ 2008 because of casting a too big number to a smaller type. The failure is in an external dll, so I can not fix it there. So how can I switch off this run time check for an external project.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果转换(和检查)发生在这个 DLL 中,而您无法重新编译,那么您就不能轻易关闭检查。
您唯一能做的就是更改传递给 DLL 的数据以避免出现问题。 或者修补二进制文件以禁用检查,这可能不会太困难,因为这类事情会发生——你擅长反汇编吗?
If the cast (and check) is happening in this DLL which you can't recompile, then you can't easily turn off the check.
The only thing you could do is change the data which you pass to the DLL to avoid the problem. Or patch the binary to disable the check, which probably wouldn't be terribly difficult as that sort of thing goes - are you good with a disassembler?
运行时检查取决于选项 /RTC c 可以在项目的 Visual Studio 配置属性、C/C++ 代码生成、“较小类型检查”中找到。 您应该关闭它,然后重新编译。
The Runtime check depends on the option /RTC c able to find in Visual Studio Configuration Properties of the project, C/C++ Code generation, "Smaller Type Check". You should switch off this, and recompile.
您始终可以在项目设置中关闭“转换为较小类型”检查。
如果当检查被编译到 dll 中时这不起作用,那么您可以尝试链接到非调试版本 dll,因为检查只能针对调试“优化”构建进行。 当然,它可能会影响您的调试。
You can always just turn off the cast to smaller type check in the project settings.
If that doesn't work as the check is compiled into the dll, then you can try linking to the non-debug version dll, as the check can only be on for debug "optimized" build. It might affect your debugging though of course.