title: What does MethodImplAttribute(InternalCall, Runtime) do for methods of COM Interop interfaces?
body: <p>In <a href="http://archive.msdn.microsoft.com/WindowsAPICodePack">Windows API Code Pack for .NET Framework</a>, many methods of COM Interop interfaces are decorated with <code>MethodImplAttribute</code>, for example:</p>
  
  <pre><code>internal interface IShellItem
  {
      [PreserveSig]
      [MethodImpl(
          MethodImplOptions.InternalCall,
          MethodCodeType = MethodCodeType.Runtime)]
      HResult BindToHandler(
          [In] IntPtr pbc, [In] ref Guid bhid, [In] ref Guid riid,
          [Out, MarshalAs(UnmanagedType.Interface)] out IShellFolder ppv);
  </code></pre>
  
  <p>Documentation for <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.methodimploptions.aspx"><code>MethodImplOptions.InternalCall</code></a> value says:</p>
  
  <blockquote>
    <p>The call is internal, that is, it calls a method that is implemented within the common language runtime.</p>
  </blockquote>
  
  <p>Documentation for <a href="http://msdn.microsoft.com/en-us/library/4k10sb5f.aspx"><code>MethodCodeType.Runtime</code></a> says:</p>
  
  <blockquote>
    <p>Specifies that the method implementation is provided by the runtime.</p>
  </blockquote>
  
  <p>But, if I understand correctly, neither statement is correct. <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/bb761144%28v=vs.85%29.aspx"><code>IShellItem</code> is implemented in <em>shell32.dll</em></a>, according to MSDN. <em>shell32.dll</em> is not a part of CLR. What's interesting, not all methods have the <code>MethodImplAttribute</code>. <code>IShellFolder</code> does, <code>IShellLinkW</code> doesn't, <code>IShellLibrary</code> does, <code>IPersistStream</code> doesn't etc.</p>
  
  <p>Why is <code>MethodImplAttribute</code> applied to some of the COM Interop interfaces? What does it mean in this case and how does it modify behavior of interop?</p>