title: How does COM select how to marshal an interface?
body: <p>As I get it there're three ways to implement marshalling in COM:</p>
  
  <ul>
  <li>typelib marshalling</li>
  <li>proxy/stub marshalling</li>
  <li>implementing IMarshal by the object</li>
  </ul>
  
  <p>now how does the component <em>consumer</em> (user) choose which one will be used? Does it decide on its own and use the preferred way or does it call some built-in function and it solves the problem for it?</p>
  
  <p>I currently experience the following: my component implements a custom interface <code>ICustomInterface</code> that is also implemented by a component from another company. My component doesn't have a typelib and doesn't implement IMarshal. The system registry contains the HKCR\Interface{uuidof(ICustomInterface)}\ProxyStubClsid32 key with a GUID of the proxy/stub that can be traced to a library provided by that other company.</p>
  
  <p>Now when my component consumer initializes my component it calls QueryInterface() requesting IMarshal from my component and when returned E_NOINTERFACE it just does nothing. Why is this - why doesn't proxy/stub library from the other company kick in?</p>