InitializeConditionVariable entry point cannot be in kernel32.dll

I am running a manufacturer issue (using a windows thread). It compiles successfully, but on startup it shows the following error

The entry point to the InitializeConditionVariable procedure cannot be in the Kernel32.dll dynamic library.

can say what will be the reason.

+4
source share
2 answers

This is an API feature available only in Vista and later. I would suggest that you run this code on XP.

To avoid accidentally using the API functions available only in later versions of Windows, you need to define the _WIN32_WINNT macro:

#define _WIN32_WINNT 0x502 // Designed to run on Windows XP SP2 and up #include <windows.h> 

If you do not install it, it usually defaults to 0x600 in later versions of the Windows SDK, choosing Vista as the target operating system. By the way, you probably have to discard condition variables. There are not enough details in your question to offer a suitable replacement. Code that uses mutexes instead can not be hard to find.

+4
source

InitializeConditionVariable , and the corresponding APIs for condition variables are available only in Windows Vista. You can use Boost.Thread to provide an implementation of a condition variable that works in Windows XP. I wrote an article on my blog on how to use it for a lineup of producers / consumers.

+2
source

Source: https://habr.com/ru/post/1309964/


All Articles