-->

What are Native DLLs?

2020-03-09 20:29发布

问题:

When I was reading about DLLs on StackOverflow I came accross the word "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?

回答1:

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.



回答2:

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.



回答3:

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.



回答4:

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.



回答5:

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.



标签: dll native