error C2664 with InterlockedExchangePointer

M

Menny

I'm moving from VC6 to VC2003 and from multi-byte to Unicode.
After fixing all the errors related to unicode, i ended with an error i

can not resolve.
************
error C2664: 'InterlockedExchangePointer' : cannot convert parameter 1
from 'T ** ' to 'void ** '
with
[
T=MyClass
]
Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast
********************
The code is:
***************
MyClass * mQ_waiting_for_write;

InterlockedExchangePointer(&mQ_waiting_for_write, NULL);
**************

Any ideas what is the problem?
 
M

myporter

may be you can try this:
InterlockedExchangePointer((void**)(&mQ_waiting_for_write,NULL);
 
V

Victor Bazarov

Menny said:
I'm moving from VC6 to VC2003 and from multi-byte to Unicode.
After fixing all the errors related to unicode, i ended with an error i

can not resolve.
************
error C2664: 'InterlockedExchangePointer' : cannot convert parameter 1
from 'T ** ' to 'void ** '
with
[
T=MyClass
]
Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast
********************
The code is:
***************
MyClass * mQ_waiting_for_write;

InterlockedExchangePointer(&mQ_waiting_for_write, NULL);
**************

Any ideas what is the problem?

The problem is that the address of a pointer to MyClass cannot be
converted to a pointer to a pointer to void. That's what the compiler
is telling you.

Since 'InterlockedExchangePointer' is not a standard function, you need
to look in its manual for the suggested uses. Or post to a newsgroup
where that function is on topic.

V
 
M

mlimber

Menny said:
I'm moving from VC6 to VC2003 and from multi-byte to Unicode.
After fixing all the errors related to unicode, i ended with an error i

can not resolve.
************
error C2664: 'InterlockedExchangePointer' : cannot convert parameter 1
from 'T ** ' to 'void ** '
with
[
T=MyClass
]
Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast
********************
The code is:
***************
MyClass * mQ_waiting_for_write;

InterlockedExchangePointer(&mQ_waiting_for_write, NULL);
**************

Any ideas what is the problem?

It would be more apropos to post this on microsoft.public.vc.language
or similar. This forum is for standard C++, and
InterlockedExchangePointer isn't standard.

Cheers! --M
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top