Solved

Function prototype definition

Posted on 2008-10-15
1
486 Views
Last Modified: 2013-12-14
The funciton is defined as:

LONG WINAPI InterlockedCompareExchange (
    __inout LONG volatile *Destination,
    __in    LONG Exchange,
    __in    LONG Comperand
    );

In Visual 6.0, I use it as:
      int nRet = (int)::InterlockedCompareExchange((PVOID*)pI, (PVOID)nNew, (PVOID)nOld);

Compiler has no complain.

In Visual 2005, Compiler complains as such:

1>d:\develop\3.0\commonlibs\base\asm.h(47) : error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1 from 'PVOID *' to 'volatile LONG *'

What should I do?

Thanks,
XT

0
Comment
Question by:xtran888
1 Comment
 
LVL 19

Accepted Solution

by:
alb66 earned 250 total points
Comment Utility
int nRet = (int)::InterlockedCompareExchange((LONG*)pI, (LONG)nNew, (LONG)nOld);
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now