InterlockedAdd64 can't be found after adding _AFXDLL macro and clr support

198 views Asked by At

I added _AFXDLL macro and got the following two errors:

error C2039: 'InterlockedAdd64': is not a member of '`global namespace''
error C3861: 'InterlockedAdd64': identifier not found

What is the reason and how to work around the issue?

I ran into the issue while trying to add c++/clr support for DLL which uses MFC.

1

There are 1 answers

0
Yola On BEST ANSWER

Looks like I'm out of luck if I want to use clr support:

MSDN: _MANAGED Defined as 1 when the /clr compiler option is set. Otherwise, undefined.

From winnt.h:

#if !defined(_MANAGED)

#if (_MSC_VER >= 1600)

...

FORCEINLINE
LONG64
_InterlockedAdd64 (
    _Inout_ _Interlocked_operand_ LONG64 volatile *Addend,
    _In_ LONG64 Value
    )
{
...
}

#define InterlockedAdd64 _InterlockedAdd64
...

#endif // !defined(_MANAGED)