简体   繁体   English

在 Visual Studio 中关闭运行时检查

[英]Switch off Run-Time check in Visual Studio

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.我有一个问题,由于将太大的数字转换为较小的类型,因此在 Visual C++ 2008 中获得失败的运行时检查。 The failure is in an external dll, so I can not fix it there.故障出在外部 dll 中,所以我无法在那里修复它。 So how can I switch off this run time check for an external project.那么如何关闭外部项目的运行时检查。

If the cast (and check) is happening in this DLL which you can't recompile, then you can't easily turn off the check.如果强制转换(和检查)发生在您无法重新编译的这个 DLL 中,那么您就不能轻易关闭检查。

The only thing you could do is change the data which you pass to the DLL to avoid the problem.您唯一能做的就是更改传递给 DLL 的数据以避免出现问题。 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?或者修补二进制文件以禁用检查,这可能不会像这样的事情那样困难 - 你擅长反汇编吗?

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".运行时检查取决于能够在项目的 Visual Studio 配置属性、C/C++ 代码生成、“小型类型检查”中找到的选项 /RTC c。 You should switch off this, and recompile.您应该关闭它,然后重新编译。

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.如果这在检查被编译到 dll 时不起作用,那么您可以尝试链接到非调试版本的 dll,因为检查只能用于调试“优化”构建。 It might affect your debugging though of course.当然,它可能会影响您的调试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM