Hi All,

I just got the latest Axis-C++  sources from anoncvs, and when I try to
compile them I get 
the following error:

...\Axis.cpp(302) : error C2664: 'InterlockedCompareExchange' : cannot
convert parameter 1 from 'void ** ' to 'volatile LONG *'
        Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast


When I check the source I see that the function is called as:
 
        InterlockedCompareExchange( (void **), (void *), (void *) )

Whereas the prototype, according to my documentation is:

  LONG InterlockedCompareExchange( LONG volatile* Destination, LONG
Exchange, LONG Comperand );

And the compiler refuses to do the conversion from void ** to LONG
volatile *.
At first I thought the problem was only in the types used, and that
VC7.1 was being
picky about the conversions.  But after looking again I noticed that the
call is made
as:

InterlockedCompareExchange(((void **)&g_uModuleInitializing), (void
*)&exchange, (void *) &comperand))

The first thing is the casts, void** and void* that the compiler is
complaining about,
the first parameter should be a LONG volatile *, and it would be without
the cast to
(void**), but the second and third parameters should be LONG, and
according to the 
documentation, the _value_ that it is to be exchanged/compared. And NOT
the pointer. 

So my guess is that the line should be:

InterlockedCompareExchange( &g_uModuleInitializing, exchange, comperand
)

If I make this change the file compiles, but I don't know if that is the

correct fix.

The functions in question were added March 18, according to CVS.  

I attached a diff of the latest cvs version.


Kind Regards,


Rob Lievaart.

Attachment: Axis.cpp.diff
Description: Axis.cpp.diff

Reply via email to