简体   繁体   English

C ++ Qt:从dll捕获段错误

[英]c++ Qt: catching a segfault from dll

I'm loading an external dll with QLibrary. 我正在使用QLibrary加载外部dll。 In some cases the dll just crashes (seg. fault). 在某些情况下,dll只会崩溃(例如错误)。 The DLL does not throw exceptions. DLL不会引发异常。 What is the best way to handle this? 处理此问题的最佳方法是什么? I read that I need to run in a separate process/thread. 我读到我需要在单独的进程/线程中运行。 Is this the only option? 这是唯一的选择吗?

cheers, m. 干杯

Unfortunately you can't do anything with a segfault, you can try run the crashing code in a separate thread but that has the risk of leaving you with leaking resources or a massive amount of inconsistent state in your application. 不幸的是,您无法对段错误执行任何操作,可以尝试在单独的线程中运行崩溃的代码,但是这样做可能会导致资源泄漏或应用程序中大量不一致的状态。

If the .dll is yours I'd recommend trying to fix the segfault, if it's not report it as a bug and try work around it. 如果.dll是您的,则建议您尝试修复segfault,如果它没有将其报告为错误,请尝试解决该问题。

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

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