title: Creating COM interface pointer works on development machine but causes application crash on other machine
body: <p>I am using COM interop to call a method in a C# dll from a C++ application.</p>
  
  <p>The C# code is:</p>
  
  <pre><code>namespace MyLibrary
  {
    [ComVisible(true)]
    [Guid("f08942b1-db20-44aa-9713-7d28fff51e2b")]
    public interface IMyLibraryInterface
    {
      string POSRequest(string request);
    }
  
    [ComVisible(true)]
    [Guid("4d962dd5-05ed-431b-82e2-378aebe8d0dc")]
    public class MyLibraryInterface : IMyLibraryInterface
    {
      public string myRequest(string request)
      {
        ....
        return response;
      }
    }
  }
  </code></pre>
  
  <p>The calling C++ code is:</p>
  
  <pre><code>CoInitialize(NULL);
  MyLibrary::IMyLibraryInterfacePtr MyLibraryInterface(__uuidof(MyLibrary::MyLibraryInterface));
  myResult = (LPCTSTR) MyLibraryInterface-&gt;myRequest(myInput);
  CoUninitialize();
  </code></pre>
  
  <p>where the relevant tlb file has been imported:</p>
  
  <pre><code>#import "MyLibrary.tlb"
  </code></pre>
  
  <p>This works both when debugging and running a release version from my development machine, but causes the application to crash when I run this from another machine. Specifically, the line creating the pointer appears to be the issue:</p>
  
  <pre><code>MyLibrary::IMyLibraryInterfacePtr MyLibraryInterface(__uuidof(MyLibrary::MyLibraryInterface));
  </code></pre>
  
  <p>It seems like something is perhaps missing on the other machine but I can't figure out what?</p>