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

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

Hi All,I am seeing the above error in our builds since introducing TBB. I managed to determine two sources but it comes back occasionally and is very hard to track down the culprit. Does anyone else get this? Actual error:C:/devtools/vs9/VC/INCLUDE\\memory(996) : error C2733: second C linkage of overloaded function '_InterlockedCompareExchange_np' not allowed [exec] C:/devtools/vs9/VC/INCLUDE\\memory(995) : see declaration of '_InterlockedCompareExchange_np'C:/devtools/vs9/VC/INCLUDE\\memory(996) : error C2733: second C linkage of overloaded function '_InterlockedCompareExchange_np' not allowed [exec] C:/devtools/vs9/VC/INCLUDE\\memory(995) : see declaration of '_InterlockedCompareExchange_np'But we see it in "winnt.h" as well with several InterlockedXXXX. Thankfully on Mac, Linux and SOLARIS we don't have windows issues. I am assuming this is primarily with tbb/atomic so to reduce the errors problems I am not using atomics or including atomic.h in headers.1) This happened early on with BOOST. We didn't have BOOST_USE_WINDOWS_H defined as we have some old Inerviews code which is based on MFC (no we don't have time at the moment to upgrade all our old apps). BOOST then went to define some of the _InterlockedXXXX methods itself which broke TBB when the include order was after boost. Turning this on helped, we then just had to be careful with the header ordering for our MFC apps and BOOST. This was easier than TBB as it involved one header in fewer places.(MFC is pure pain so we have to order headers carefully later in our build with TBB and MFC)Does anyone have any ideas on a good fix for this? Does anyone know of other third-party libs, not just BOOST where this occurs with TBB? I have searched high and low and only found references to BOOST under WinCE, nothing for TBB.It may just be our build system but it hasn't failed us in the past (we work very hard to keep it clean and polished).Any help appreciated, thanks all!

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
jimdempseyatthecove's picture
Best Reply

long _InterlockedCompareExchange_np (long *, long, long);

Is an intrinsic function. However, your code (someone's code) may be declaring this as not intrinsic.

In the problem file, try including "intrin.h"

Jim Dempsey

www.quickthreadprogramming.com

Cheers that worked!Seems our windows build could do with some more robustness

Login to leave a comment.