有没有标准.NET库依赖于任何非托管的DLL-S?标准、依赖于、NET、DLL

2023-09-06 05:01:42 作者:心碎了、爱走了

只是出于好奇,并访问标准库时,.NET框架本身依赖于任何非托管的DLL-S?比如我调用方法A和-under的hood-该方法一或方法A内的任何其他方法执行的PInvoke对非托管DLL?

Just out of curiosity, does the .NET framework itself depend on any unmanaged DLL-s when accessing the standard library ? For example i call method A and -under the hood- that method A or any other method inside that method A executes a PInvoke against an unmanaged DLL ?

推荐答案

是的,.NET库使用非托管功能很多。有两种类型的非托管函数(据我所知)库可以拨打:从框架本身或者方法,或者从(使用PInvoke的)其他DLL方法

Yes, the .Net libraries use unmanaged functions a lot. There are two types of unmanaged functions (that I know) the library can call: either methods from the Framework itself, or methods from some other DLL (using PInvoke).

这是在框架中实现的方法都标有 [MethodImpl(MethodImplOptions.InternalCall)] 。那些来自其他非托管的DLL都标有 [的DllImport]

The methods that are implemented in the framework are marked with [MethodImpl(MethodImplOptions.InternalCall)]. Those that come from other unmanaged DLLs are marked with [DllImport].

在我的版本单独mscorlib.dll中,有是从由框架内部实现7241的方法(例如的吸气 string.length减)和535一些非托管的DLL(其中许多人是在内部类 Win32Native )。

In my version of mscorlib.dll alone, there is 7241 methods that are implemented internally by the framework (e.g. the getter of string.Length) and 535 that are from some unmanaged DLL (many of them are in the internal class Win32Native).