tags:

views:

12

answers:

1

When we define a COM interface in MIDL (Microsoft Interface Decription Language), we should utilize the oleautomation compatible data types. These types could be recognized by the COM aware languages.

Suddenly, the .NET CTS (Common Type Specification) flashed into my mind. The CTS is the minimum subset of types that any .NET compatible language must respect.

Aren't the CTS and oleautomation compatible types very similar? Does the CTS evolve from oleautomation compatible types?

Many thanks.

A: 

Well, not really. The set of types compatible with oleauto is rather restrictive so it isn't particularly surprising that there's a one-to-one mapping with managed (value) types. But important oleauto types like VARIANT, SAFEARRAY, IDispatch* and HRESULT have no direct mapping. That they actually can be mapped to, respectively, object, System.Array, __ComObject and System.Exception is thanks to the COM interop built into the CLR. That's cold hard code that is not in any way prescribed by the CTS.

Hans Passant
Thanks for your reply. I don't mean mapping between these 2 type schema. I just have the feeling that both of them are made for the same purpose. To be a common base on which communication between different languages could be possible. Aren't they?
smwikipedia
Yes, the oleauto type set was specifically designed to allow languages to interop with well defined behavior. Just like CTS.
Hans Passant
Thanks Hans. And thanks for answering my other questions. ;)
smwikipedia