改进dll缺失错误信息
我有一个用 QT 编写的程序,运行得很好。然而,它间接依赖于 dnssd.dll,因为程序加载的 dll 使用 bonjour。如果 bonjour 没有安装在运行该程序的机器上,它会说
程序无法启动,因为您的系统中缺少 dnssd.dll 电脑。尝试重新安装程序来解决问题。
我没有通过 LoadLibrary 或其他方式加载此 dll。我将二进制文件链接到存根,以便它在 int main
之前自动加载。
显然,重新安装程序并不能解决问题。对我来说,它清楚地表明我需要安装 bonjour,但对于大多数用户来说,这是极其神秘的。
我宁愿让此错误消息提供更多信息,例如“需要安装 Bonjour 才能使该应用程序正常工作,请转到 [insert-url-here] 下载它。”
有没有办法检测 dll 何时无法加载并给出更好的错误消息?
I have a program written in QT that works just fine. However it has an indirect dependency on dnssd.dll since a dll loaded by the program uses bonjour. If bonjour is not installed on the machine running the program it will say
The program can't start because dnssd.dll is missing from your
computer. Try reinstalling the program to fix the problem.
I'm not loading this dll via LoadLibrary
or otherwise. I linked the binary against the stub so it's loaded automatically before int main
.
Obviously reinstalling the program does not fix the problem. For me it clearly says I need to install bonjour, but for most users this is extremly cryptic.
I would rather have this error message be something more informative such as "Bonjour needs to be installed for this application to work properly, go to [insert-url-here] to download it."
Is there a way to detect when a dll fails to load loke this and give a better error message?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将其设置为延迟加载,然后尽早(在导致加载发生之前)尝试自己加载它(使用 LoadLibrary)并报告问题。
http://msdn.microsoft.com/en-us/library/151kt790.aspx
Set it to delay load, then as early as possible (before you cause loading to happen), try to load it yourself (with LoadLibrary) and report the problem.
http://msdn.microsoft.com/en-us/library/151kt790.aspx