0

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.

Yola
  • 18,496
  • 11
  • 65
  • 106
  • from the documentation, you might want to try this instead: This function is implemented using a compiler intrinsic where possible. For more information, see the Winbase.h header file and _InterlockedAdd64. – franji1 Dec 17 '20 at 16:46
  • Related: [InterlockedIncrement64 with managed C++](https://stackoverflow.com/questions/37549166/interlockedincrement64-with-managed-c). – dxiv Dec 17 '20 at 18:37

1 Answers1

0

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)
Yola
  • 18,496
  • 11
  • 65
  • 106