Advanced Interop Marshaling Considerations

When you use a COM object from a managed client or a managed object from a COM/Win32 client, the CLR must perform marshaling. For the purposes of this discussion, marshaling is just converting the parameters from managed types on the client to unmanaged types in the object and vice versa. What I am talking about here is different than COM marshaling. As I discussed earlier, if your managed thread has entered an MTA and you are calling a single-threaded (STA) object, cross-apartment marshaling will be used. Similarly, interprocess marshaling will be used if you use an object that is implemented in an out-of-process server. This marshaling is independent of the managed-to-unmanaged code marshaling that ...

Get .NET and COM Interoperability Handbook, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.