cout breaks coinitialize

I'm old at c++ but new to COM. coinitialize() works if I remove all uses of cout. If I include a single cout, such as cout << "top" << endl; anywhere in the code...even much later than my coinitialize call, coinitialize() fails. Of course I #include to get cout to compile. I am using Visual Studio 2003. A lot of trial and error has not worked for me yet. Has anyone had this observation and gotten around it?

aqstws

#518257

try using fprint?

#519214

I am using printf. I don't have a problem printing. Even cout prints. But my problem is not getting strings out. It's that I don't know why it breaks a COM function. I have other COM code problems, and so I am trying to make sure that every COM function I use works exactly how it should work. How can an unrelated c++ function have this effect on COM? I'm learnign COM. Its' COM that's showing me something I don't understand. Does COM set up a streaming path, like cout uses?

The convenience of cout is that in the strongly typed code of c and c++, I don't need to know the variable types of whatever I am printing. I don't know how c++ does this. Does COM need that streaming pathway?

#519388

no there are no conflicts that I know besides "getche()" are you using a loop or logical if thats being broken by value returned null?

#519849

Are you doing multiple threads? COM is very stubborn with threading.

If not, it still needs to have someone poll the window procedures so that its SendMessage based marshaller can operate...

#519866