1 //==- llvm/Support/Windows/COM.inc - Windows COM Implementation -*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements the Windows portion of COM support.
12 //===----------------------------------------------------------------------===//
14 //===----------------------------------------------------------------------===//
15 //=== WARNING: Implementation here must contain only Windows code.
16 //===----------------------------------------------------------------------===//
23 InitializeCOMRAII::InitializeCOMRAII(COMThreadingMode Threading,
24 bool SpeedOverMemory) {
26 if (Threading == COMThreadingMode::SingleThreaded)
27 Coinit |= COINIT_APARTMENTTHREADED;
29 Coinit |= COINIT_MULTITHREADED;
31 Coinit |= COINIT_SPEED_OVER_MEMORY;
32 ::CoInitializeEx(nullptr, Coinit);
35 InitializeCOMRAII::~InitializeCOMRAII() { ::CoUninitialize(); }