locked
CoInitialize/CoUninitialize pair at app level, or at function level? RRS feed

  • Question

  • I've seen example of use of CoInitialize/CoUninitialize pair at app level, where they "bracket" the whole app and are called just once each at start and end of the app.

    But I've also seen examples where they are called at the start and end of a single function. This means that they are called more often, presumably.

    Which is best?



    http://www.ransen.com Cad and Graphics software

    Thursday, March 5, 2015 2:15 PM

Answers

  • On 3/5/2015 9:15 AM, "Owen Ransen" wrote:

    Which is best?

    Once per thread. If your application is single-threaded, this means once for the whole application.


    Igor Tandetnik
    • Proposed as answer by Henri Hein Thursday, March 5, 2015 8:08 PM
    • Marked as answer by Owen Ransen Friday, March 6, 2015 5:23 AM
    Thursday, March 5, 2015 2:27 PM

All replies

  • On 3/5/2015 9:15 AM, "Owen Ransen" wrote:

    Which is best?

    Once per thread. If your application is single-threaded, this means once for the whole application.


    Igor Tandetnik
    • Proposed as answer by Henri Hein Thursday, March 5, 2015 8:08 PM
    • Marked as answer by Owen Ransen Friday, March 6, 2015 5:23 AM
    Thursday, March 5, 2015 2:27 PM
  • Yes, it is a single threaded exe. Thanks!


    http://www.ransen.com Cad and Graphics software

    Thursday, March 5, 2015 2:36 PM