Intrin.h

by 2 contributors:

MSVC 2005 has bugs when including <intrin.h>.

Second linkage error

If you get the following errors:

error C2733: second C linkage of overloaded function '_interlockedbittestandset' not allowed

error C2733: second C linkage of overloaded function '_interlockedbittestandreset' not allowed

They happen when both <intrin.h> and <windows.h> are included in the same file.  One way to get around it is to define a rename for these functions before including intrin.h. E.g.:

#if _MSC_VER <= 1400
#define _interlockedbittestandreset _interlockedbittestandreset_NAME_CHANGED_TO_AVOID_MSVS2005_ERROR
#define _interlockedbittestandset _interlockedbittestandset_NAME_CHANGED_TO_AVOID_MSVS2005_ERROR
#endif

Unresolved external for intrinsic function

If you get the following or a similar linker error when using an intrinsic function such as _ReadBarrier, _WriteBarrier, _ReadWriteBarrier, etc.

error LNK2019: unresolved external symbol __ReadWriteBarrier referenced in function

You need to explicitly declare the function as intrinsic (even if you included <intrin.h>). E.g.:

#pragma intrinsic(_ReadWriteBarrier)

See here: http://connect.microsoft.com/VisualS...details/100051

Document Tags and Contributors

Contributors to this page: Sheppy, felipc
Last updated by: Sheppy,