In other words, does the .NET framework eventually make calls somewhere to get its work done? Or did Microsoft completely re-create all the functionality of the win32 library in their .NET framework.
Thanks!
In other words, does the .NET framework eventually make calls somewhere to get its work done? Or did Microsoft completely re-create all the functionality of the win32 library in their .NET framework.
Thanks!
In some cases (most, perhaps? I haven't reflected through the entire framework) the .NET framework makes calls to win32. Most controls are simply win32-controls wrapped with a few new features.
A .NET application is just another Win32 process, so there is no magic and obviously it is going to use the underline operating system. Even the .NET libraries use Win32 to a great extent.
Examples:
Memory management is handled internally for managed code, but for the process itself it is handled just like any other Win32 process.
Currently managed threads are implemented as OS threads as well.
It is a mix. Obviously, things like winforms are largely wrappers around Win32 functionality (or a mix of both worlds), but WPF is a lot more managed (in terms of the actual control code; under the hood, as Mash notes, it may use DirectX for the rendering). Likewise, things like file/network access are (by necessity) wrappers around the OS objects, as are the unmanaged lock objects like Mutex
- but many other things are 100% managed.
So it isn't a simple answer.
(edit) Also - keep in mind that ".NET" is a very vague term; Compact Framework, Micro Framework, Silverlight etc may have different, non-win32 implementations.
Yes, it calls win32 functions internally. For example the OpenRead method in File class contains:
return new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
and it will eventually call:
SafeFileHandle handle = CreateFile(lpFileName, dwDesiredAccess, dwShareMode, securityAttrs, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
which is a win32 native function, deep down in the method.
It does call the .NET API as all Windows applications do. But it is more than just a simple wrapper or map, it is more accurately described as an abstraction.
Update: realised I answered the wrong question (you said runtime not class library)...oh well I'll keep the guff below in anyway!
It depends on the part of the library:
That's just from fiddling with Reflector. Obviously being a COM server the Microsoft CLR relies heavily on win32 too.