“运行时”到底是什么?
我的公司总是遇到软件因“运行时间”或丢失而无法工作的问题。我经常听到人们这么说(你需要 32 位运行时、Microsoft 运行时等)。
到底指的是什么? DLL 文件?有什么不同吗?有人可以澄清一下吗?
My company is always having problems with software not working because "run-times" or missing. I hear people say this a lot (you need the 32-bit run times, Microsoft run-times, etc etc).
What exactly is being referred to? DLL files? Something different? Can anyone please clarify?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
运行时基本上是代码运行的时间(而不是编译时或链接时)。
在您所看到的上下文中,它意味着运行时库,即加载和执行程序所需的那些库。
这是动态链接的东西(DLL 或共享对象),因为静态链接的代码不能丢失(它在可执行文件本身中)。
一个典型的例子是依赖 Microsoft 的 C 运行时或 .NET 库,但不将它们随您的产品一起提供。这意味着您的可执行文件将在任何已安装这些库的计算机(例如安装了 Visual Studio 的计算机)上运行,但不一定是您想要运行代码的每台计算机。
我在此处回答了有关差异的问题静态和动态链接之间的关系有望增加您的知识。动态链接允许您更新应用程序的某些部分,而无需重新编译或重新链接。您可以通过放入新版本的 DLL 来完成此操作。不幸的是,将该代码放在单独的文件中意味着它可能会丢失。
这将是问题的原因之一,但我怀疑最有可能的是有人没有很好地完成安装代码,否则所需的所有内容都会被安装。
Run-time is basically the time at which your code is running (as opposed to compile-time or link-time).
In the context you're seeing it, it means run-time libraries, those libraries needed to load an execute your program.
This is dynamically linked stuff (DLLs or shared objects) since statically linked code can't be missing (it's in the executable file itself).
A classic example is to depend on Microsoft's C run-time or .NET libraries but not ship them with your product. That means your executable will run on any machine that has those libraries already there (such as those with Visual Studio installed) but not necessarily every computer you want to run your code on.
I answered a question here regarding the difference between static and dynamic linking which should hopefully add to your knowledge. The dynamic linking allows you to update certain parts of the application without recompiling or relinking. You do this by dropping in a new version of the DLL. Unfortunately, having that code in a separate file means it can go missing.
That would be one cause of the problem but I suspect the most likely is just that someone didn't do their installation code very well, otherwise everything needed would have been installed.
在这种情况下,
运行时
是一个运行时库
- 一种共享库(在 Windows 上实际上是一个 DLL),最常见的是专门指提供该语言的基本功能的库。它实现了被认为“内置于”语言核心的功能。因此,如果没有安装这样的库,或者如果程序是专门静态链接的(将所需的所有内容打包到可执行文件中),则使用需要运行时库的编译器编译的程序将无法运行。A
runtime
in this context is aruntime library
- a shared library (on Windows indeed a DLL), most commonly specifically referring to the one which provides basic functionality of the language. It implements the functions that are thought to be "built into" a language core. Thus, no program compiled with a compiler which requires a runtime library will run if such a library for it is not installed - or if the program is specifically statically linked (with everything needed packed into the executable).给您一个实际示例 - 以下是一些常见运行时的链接:
这些是系统范围的安装 - 因此任何需要特定运行时的软件在安装后都可以使用它。
To give you a practical example - here are some links to some common runtimes:
These are system-wide installs - so any software that requires a particular runtime will be able to use it, once installed.
他们可能指的是 Microsoft 的第 3 方库和 .NET 框架。
您公司的应用程序可能使用一些第三方库,例如 MFC、ATL 等。如果应用程序是用 .NET 语言编写的,例如 C#、VB.NET,如果您使用 Java 进行开发,则有一个 JRE(Java 运行时环境)必须安装应用程序才能运行。
如果所需的 dll/框架未安装/部署在客户的计算机上,您可能会收到“运行时错误”。
这是一个部署问题 - 可以通过正确的安装过程来解决 - 例如,安装程序可以检查是否安装了所需的框架,如果没有安装,则将其作为安装过程的一部分进行安装。
They are probably referring to Microsoft's 3rd party libraries and the .NET framework.
Your company's applications probably uses some 3rd party libraries such as MFC, ATL etc. in case of application's written in a .NET language e.g. C#, VB.NET, if you're developeing using Java there is a JRE (Java Runtime env) that have to be installed for the application to run.
If the required dlls/framework ween't installed/deployed on the customer's machine you'll probably get a "runtime error".
This is a deployment issue - which with the correct install process can be solved - e.g. the installer can check if the required framework is installed and if not install it as part of the installation process.