title: How do I get HRESULT returns from libraries imported to c# with tlbimp.exe?
body: <p>I am using the GMFBridge directshow filter from c# and the import library seems to discard the HRESULTs. i.e</p>
  
  <pre><code>[id(5), helpstring("Create render filters in empty render graph")]
  HRESULT CreateRenderGraph(
    [in] IUnknown* pSourceGraphSinkFilter,
    [in] IUnknown* pRenderGraph,
    [out, retval] IUnknown** pRenderGraphSourceFilter);
  
  [id(6), helpstring("Connect two graphs")]
  HRESULT BridgeGraphs(
    [in] IUnknown* pSourceGraphSinkFilter,
    [in] IUnknown* pRenderGraphSourceFilter);
  </code></pre>
  
  <p>is translated (by midl.exe and tlbimp.exe) into:</p>
  
  <pre><code>[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime), DispId(5)]
  object CreateRenderGraph([In, MarshalAs(UnmanagedType.IUnknown)] object pSourceGraphSinkFilter, [In, MarshalAs(UnmanagedType.IUnknown)] object pRenderGraph);
  
  [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime), DispId(6)]
  void BridgeGraphs([In, MarshalAs(UnmanagedType.IUnknown)] object pSourceGraphSinkFilter, [In, MarshalAs(UnmanagedType.IUnknown)] object pRenderGraphSourceFilter);
  </code></pre>
  
  <p>Other COM libraries I have imported translate returned values as out parameters and preserve the HRESULT return value of the original COM method.  Why does this library behave differently?  Is it possible to force the other behaviour?</p>
  
  <p>Thanks,
  Andy</p>