문제

I am forced to run some applications in windows 98 se. vc6 has strange InterlockedCompareExchange definition:

void* InterlockedCompareExchange(void**, void*, void*);

msdn defines it like this however (since windows xp):

LONG InterlockedCompareExchange(LONG*, LONG, LONG);

Does anyone remembers how to use it (I need to atomically get value of interlocked variable)?

도움이 되었습니까?

해결책

Windows 98 did not support 64bit, so void* and LONG are the same byte size. Most OSes actually use the LONG definition, but if VC6 is using `void* then simply type-cast where needed:

LONG value;
LONG ret = (LONG) InterlockedCompareExchange((void**)&value, (void*)ExchangeValue, (void*)CompareValue);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top