The same code works fine if /clr enabled
Sure. It was the CLR that took care of calling CoInitializeEx() before. Picking the apartment type from the [STAThread] attribute on the Main() entrypoint or the value you passed to Thread::SetApartmentState(), if any. Default is MTA.
That's not happening anymore since you now compile without /clr. You therefore must call CoInitializeEx() yourself.