Is it safe to call across CRT boundaries using COM?

82 Views Asked by At

We are in the process of upgrading our compiler from Visual Studion 2010 (MSVC 10) to VS2013 (MSVC 12). Obviously, this involves a change in CRT version; and inevitably it also involves finding third-party libraries that don't have a VS2013 version available.

I have read up on the dangers of passing objects across the boundary between different CRTs, but most of the third-party libraries I mentioned are exposed to us over COM.

Is it always, never, or sometimes safe to call across a CRT boundary using COM? If "sometimes", what governs whether it's safe?

1

There are 1 best solutions below

2
On BEST ANSWER

What is important here is what calls are actually in question. If objects are talking one to another via COM interfaces, then it is safe to mix them in any combination. It is the same COM in older and newer modules. The problem only arises when you do CRT calls, and one module is manipulating with objects that belong to a different CRT version, e.g. new in one module and then delete in another. You don't have this problem when you pass COM pointers and call COM methods.