如果链接到DLL,是否可以在缺少该DLL时启动可执行文件(If you link against a DLL, is it possible to launch your executable if

编程入门 行业动态 更新时间:2024-10-12 01:28:40
如果链接到DLL,是否可以在缺少该DLL时启动可执行文件(If you link against a DLL, is it possible to launch your executable if that DLL is missing)

一位同事和我正在讨论,我们都不确定这是如何工作的。 假设您创建了一个使用Bar.DLL函数Foo()的程序。

如果缺少Bar.DLL,是否仍然可以启动程序,它只会在尝试调用Foo()时崩溃,或者程序是否会无法启动?

A coworker and I were having a discussion and neither of us is actually sure of how this would work. Let's say that you create a program that uses function Foo() from Bar.DLL.

If Bar.DLL is missing, will it still be possible to launch the program and it will just crash when attempting to call Foo() or will the program simply fail to launch?

最满意答案

在dll丢失时运行应用程序的唯一方法是,当该dll动态加载时,应用程序运行并且(可能)显示错误信息,但不会崩溃

如果该dll是静态加载的,则应用程序永远不会运行,OS会显示标准错误消息

The only way to run a app when a dll is missing, is when that dll is DYNAMICALLY LOADED, the app runs and (maybe) shows a error msg, but dont crash

if that dll is statically loaded, the app never runs and OS shows you a standard error msg

更多推荐

本文发布于:2023-07-18 04:28:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1154791.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:可执行文件   链接   DLL   link   executable

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!