When you run the program in Windows XP, a window pops up with the message:

The entry point to the InitializeConditionVariable procedure was not found in the Kernel32.dll library.

How to treat?

Access to the program code is, I can write a function that implements the same functionality using SetEvent() . How to make, that depending on OS this or that function was caused? In my opinion, this is the easiest solution.

    3 answers 3

    Make a wrapper for the condition variable (if it does not already exist), and call the InitializeConditionVariable function via GetProcAddress , and if not, use analogs

    True, according to the Chromium developers, it is hard to make a correct CV implementation under WinXP, and it will not work quickly. You can look at github

    They use GetProcAdress to get functions and the pimpl idiom to select an implementation (for Vista or XP)

    • I like this solution, when starting the program, check if there is a function and use either it or your own. Now I will try to implement. - mikelsv
    • Implementing under XP is pretty simple. I first made it, and then I learned that everything is already there. Well, if it slows down, then this is already a Windows XP problem. - mikelsv
    • 2
      @mikelsv No, if it hurts your problem - Cerbo
    • one
      I will clarify: this is the problem of the one who set himself XP. In general, I do not really understand where and what can be slow down. I implemented as efficiently as possible and if something slows down, then it should be so. - mikelsv 5:57 pm

    Condition Variable is an innovation that is not in XP. They appeared with Vista. Thus, it can only be treated surgically - replace the condition variable with something else, or use conditional compilation - for XP, one thing, for Vista + another. Better yet, use std::condition_variable completely abandoning the platform-dependent solution.

    • I know that they are not in XP. Refuse to be dependent on the server in favor of the std dependent? No, thank you, do not. - mikelsv
    • 9
      @mikelsv, std is the standard library, just in case. - ixSci

    GetVersion () and depending on the return value of a particular code. Only you will have to abandon the Import InitializeConditionVariable, and instead look for (load) the DLL, get the address of the desired function from it and call it. True, MS does not recommend GetVersion () now ...