سؤال

I have intrinsics enabled in the optimization settings for the compiler, however, the resulting code for InterlockedExchange is generating calls into kernel32.dll rather than producing inline assembly. This is especially problematic because the function is not available on versions of windows prior to Vista.

The MSDN documentation states "This function is implemented using a compiler intrinsic where possible". Is it possible to get the compiler to use actual intrinsic code for InterlockedExchange?

هل كانت مفيدة؟

المحلول

the interlocked intrinsics require an underscore prefix (or #pragma intrinsic), so you want to use _InterlockedExchange, you will also need to include intrin.h

also, you you read your quote fully, it says this:

This function is implemented using a compiler intrinsic where possible. For more information, see the Winbase.h header file and _InterlockedExchange.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top