Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Relation between COM and WinRT

I didn't get a clear understanding of similarities/differences or the relation itself between COM (Component Object Model) and WinRT (Windows Runtime).

In my understanding both of them are there to provide a "runtime engine" to enable component to communicate... Is that the CLR (Common Language Runtime)?

WinRT came in with Windows 8 to enable a common platform for many languages.

What I didn't get here is that, did WinRT replace COM? Are they the same?

like image 255
DDan Avatar asked Sep 18 '25 03:09

DDan


2 Answers

COM is "just" a binary-interface standard for software component (from wikipedia). There is no runtime, no set of base/utility classes (well, there are some, like cross thread/process marshaling, the registry, COM+, but you can do COM without it).

COM is used absolutely everywhere in Windows, used in clients and servers, because it's, in its deep heart, "just" a vtable binding contract.

WinRT is a full blown API on top of COM (again, no engine). So, it comes with a set of base classes. It's defacto very oriented for UI applications (Windows Store). WinRT also comes with a set of services (metadata, type system, deployment/store, etc.). An useful WinRT introduction is available here: WinRT demystified

The CLR is the execution engine that powers .NET programs. It can be used on clients and servers. For example, the garbage collector is implemented there. In fact, it's been ported to other platforms than Windows these last years as an open source project: CoreCLR The Windows CLR uses COM only for some of its work, mostly for communicating with the Windows platform. WinRT does not uses the CLR.

like image 113
Simon Mourier Avatar answered Sep 19 '25 17:09

Simon Mourier


Windows kernel is written in C language and Windows component are written in C++. When your front end application(say Visual Basic or c#) needs to intact with these components, you need some type of mechanism/standard to interact with these components. This interaction mechanism//standard is called COM.

As per Microsoft "COM is a platform-independent, distributed, object-oriented system for creating binary software components that can interact".

Please note that you do not need .Net run-time to interact with COM component. It can be called by using old languages like Visual Basic, VC++ etc.

Now most the application being developed in .Net and .Net applications have to interact with windows components. Microsoft build a layer(API) on the top of windows component, so that .Net application can be interact with windows component smoothly. This layer is WinRT. As a front end developer, you need to interact with WinRT and WinRT will interact with Windows Component on your behalf.

For .Net Applications, WinRT will replace COM eventually. but for Non .Net applications, COM is still alive.

like image 34
Thakur Avatar answered Sep 19 '25 16:09

Thakur