On Jul 2, 2004, at 9:11 AM, Adnene Ben Abdallah wrote:
Hi,
I had a problem when I tried to build log4cxx with the last MS Platform
SDK available. I got the following message:
--------------------Configuration: dll - Win32 Release--------------------
Compiling...
condition.cpp
F:\Development\IPA\log4\log4cxx-0.9.7\src\condition.cpp(73) : 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
Error executing cl.exe.
log4cxx.dll - 1 error(s), 0 warning(s)
This seems to be the same problem.
Could you please confirm that? I suppose that the patch you had proposed
isn't enough. I suppose that here we need more than "#if _MSC_VER <= 1200",
but I can't see what would be the right condition to add?
The prototypes for InterlockedCompareExchange, InterlockedIncrement etc in winbase.h was changed sometime between VC6 and VC7.
I assume that you are using either VC5 or VC6 (it shouldn't matter) to compile log4cxx with a more recent Platform SDK in the include path. The conditionals use the compiler version as an indication of the version of the Platform header files being used which results in an inappropriate choice of the older prototypes.
I don't see a way to calls these methods that would work for both prototypes, so the best solution would be to add another preprocessor macro to config_msvc.h that allows explicitly specifying whether the older or newer interlock prototypes should be used. If something like:
#if !defined(HAVE_OLD_MS_INTERLOCK) #if _MSC_VER <= 1200 #define HAVE_OLD_MS_INTERLOCK 1 #else #define HAVE_OLD_MS_INTERLOCK 0 #endif #endif
were added to config.h and
#if _MSC_VER == 1200
where changed to
#if HAVE_OLD_MS_INTERLOCK
Then VC5-7 would build properly with their provided include files and VC5 and 6 could use current include files by explicitly specifying HAVE_OLD_MS_INTERLOCK=0 in config_msvc.h or on the command line.
