什么是本机 DLL?
当我在 StackOverflow 上阅读有关 DLL 的内容时,我多次遇到“本机 DLL”这个术语。我发现了有关它们的问题,但我无法理解“本机 DLL”实际上是什么。
什么是本机 DLL?
When I was reading about DLLs on StackOverflow I came across the term "Native DLLs" a lot of times. I found questions regarding them but I couldn't understand what a "Native DLL" actually is.
What is a native DLL?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
本机 DLL 通常是包含原始处理器直接可执行代码(例如在 Win32 API 中找到的代码)的 DLL,而不是例如托管 (MSIL),后者包含由运行时使用和 JIT 编译为本机处理器指令的代码,例如作为 .NET CLR。
在.NET 中,还可以创建包含本机二进制代码和托管代码的混合模式DLL。
Native DLL's are usually DLL's containing raw processor directly-executable code (such as that found in the Win32 API's) as opposed to, for example, managed (MSIL) which contain code that is consumed and JIT compiled to native processor instructions by a runtime such as the .NET CLR.
In .NET it is also possible to create mixed-mode DLL's that contain both native binary code and managed code.
当来自 .net 程序集的托管代码被发明时,这个术语就出现了,以区分托管和非托管=本机代码。
每个 .net 程序集在执行期间都会被 JIT 编译器“本地化”。这意味着它会被转换为 CPU“本机”可以理解的 asm 代码。
this term came out when managed code that comes from .net assemblies was invented, to distinguish between managed and unmanaged =native code.
every .net assembly gets "nativied" by the JIT-compiler during execution. this means it gets translated to asm code that is "natively" understandable to the CPU.
本机 DLL 一词最初是在托管代码存在之前使用的。它最初是指非 COM DLL 的 DLL。它旨在指代类似于 Windows 中的 DLL。
请注意,Kev 说“在 .NET 中,还可以创建包含本机二进制代码和托管代码的混合模式 DLL。”,但这并不相关;这样的 DLL 不是本机 DLL,因为它具有 CLI (.Net) 元数据。此外,混合模式 DLL 只能使用 C++/CLI 进行开发;没有其他语言支持它。
请参阅我的文章 本机 Windows 动态链接库 (DLL) ) 了解更多。
The term native DLL was originally used before managed code existed. It was originally intended to refer to DLLs that are not COM DLLs. It is intended to refer to DLLs like the ones in Windows originally.
Note that Kev said "In .NET it is also possible to create mixed-mode DLL's that contain both native binary code and managed code." but that is not relevant; such a DLL is not a native DLL because it has CLI (.Net) metadata. Also, mixed-mode DLL's can only be developed using C++/CLI; no other language supports it.
See my article Native Windows Dynamic Link Libraries (DLLs) for more.
据我了解,“本机 DLL”将是一个基本的 Win32 dll。包含非托管代码的 DLL。
使用.NET,您可以编写托管程序集。这些将调用基本级别的 Windows 代码,这与非托管应用程序将调用的代码相同。
From what I understand a "Native DLL" will be a basic Win32 dll for example. A DLL that contains non managed code.
With .NET you write Managed assemblies. These will call the base level Windows code which is the same that a non-managed application will call.
快速浏览这些 MSDN 搜索结果将回答您的问题:
http://social.msdn.microsoft.com/Search/en-US?query=define:%20native%20dll&ac=8
这是一个简单的包含机器代码的 DLL,而不是MSIL。
A quick look through these MSDN search results will answer your question:
http://social.msdn.microsoft.com/Search/en-US?query=define:%20native%20dll&ac=8
It's simple a DLL that contains machine code, rather than MSIL.