title: Using std::cout in DLL called from C#
body: <p>My Windows app has a C# part and a C++ part. The C# app shows a console window when it's ran.</p>
  
  <p>The C++ code is compiled into a DLL which is used from C# via P/Invoke.</p>
  
  <p>The problem is that printing text from the C++ DLL via std::cout doesn't print anything. Printing from C# works fine.</p>
  
  <p>I suspect C# has taken over the console, so C++ can't get a handle to it. The fix might be to get a console handle from C#, pass it over to C++, and use it to connect std::cout to the console window. But I don't know how to go about doing that.</p>
  
  <p>Any ideas?</p>
  
  <p><strong>Edit:</strong> My C++ code is unmanaged.</p>