DLL崩溃使应用程序崩溃 [英] DLL crash crashing Application

查看:747
本文介绍了DLL崩溃使应用程序崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使我的应用程序免于崩溃的影响,在运行时当它使用的DLL中可能发生崩溃时.

How to make my application safe from crashing, when at runtime there is possible crash in the DLL it is using.

示例:假设我的"Application1"正在使用第三方"dll1".由于某些错误的编程"dll1",在处理调用"GetSummary"时(例如),导致运行时异常,并且崩溃.如何确保我的应用程序1"不会崩溃?

Example: Say my "Application1" is using third party "dll1". Becuase of some bad programming "dll1" gets a runtime exception in processing call "GetSummary" (just for example) and it crashes. How can I assure my "Application 1" does not crash?

如果DLL是用C编写的,或者没有引发任何异常,我们如何处理它?<​​/p>

If the DLL is written in C or it is not throwing any exception, how can we handle it?

推荐答案

在您没有源代码之前,实际上无法解决DLL中的崩溃.

Actually crash in DLL cannot be solved until u have the source code.

但是从您的角度来看.

您可以将DLL加载部分放在try {...} catch(中. ..){}.

You can place the DLL loading part in try{ ... } catch( ... ){} .

这将帮助您的应用程序不会崩溃.但是我必须确保DLL不会出错,以便不能使用DLL函数.

Which will help your application to not get crashed. But i you have to ensure that DLL is not making errors so that DLL functions cannot be used.


使用 C ++异常处理阻止错误.


您的问题的信息存在冲突.您说"dll1" 获取运行时异常"; (我想象你的意思是引发运行时异常"),但是你也说如果DLL用C编写或没有引发任何异常,我们如何处理它".是不是抛出异常? Application1用什么语言编写?如果没有引发异常,那应该不成问题.如果是这样,并且您正在使用C ++,则捕获异常并排除它.
Your question has conflicting information. You say "dll1" "gets a runtime exception" (I imagine you mean "throws a runtime exception"), but you also say "if the DLL is written in C or is not throwing any exception, how can we handle it". Is it or isn''t it throwing an exception? And what language is Application1 written in? If it''s not throwing an exception, then it shouldn''t be a problem. If it is and you''re working with C++, then catch the exception and suppress it.


这篇关于DLL崩溃使应用程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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