Log4cxx
  1. Log4cxx
  2. LOGCXX-8

Compilation problems using VC5 or VC6 with later Platform SDKs

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.7
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Thread starting at:
      http://nagoya.apache.org/eyebrowse/ReadMsg?listName=log4cxx-user@logging.apache.org&msgNo=165

      The major issue is that the prototypes for the InterlockedCompareExchange and similar methods were changed in the Platform SDK sometime after the release of VC6. The existing log4cxx code used #if _MSC_VER == 1200 to select whether to use the old form or the new form. That has two problems, VC5 is shipped with the old SDK but compiles with the new signature since its value of _MSC_VER is not equal to 1200 (it is less). Second, it is possible to use the older compiler with later Platform SDK's that use the new signatures. In that case, the compiler version is not a reliable indication of the form of the prototypes.

      The proposed solution is to add a distinct macro LOG4CXX_OLD_WIN32_INTERLOCKS that would control whether the old or new form are used. Unless set externally, this would be initialized in config_msvc.h based on the _MSC_VER.

      VC5 compilation had a few other issues where internal compiler errors would occur on valid C++ code.

      1. vc5.patch
        9 kB
        Curt Arnold

        Activity

        Hide
        Curt Arnold added a comment -

        Visual Studio uses may need to manually update their config.h or config_msvc.h to incorporate the changes to config_msvc.h.in.

        Show
        Curt Arnold added a comment - Visual Studio uses may need to manually update their config.h or config_msvc.h to incorporate the changes to config_msvc.h.in.
        Hide
        Curt Arnold added a comment -

        Changed macro name to LOG4CXX_HAVE_OLD_WIN32_INTERLOCKS, to build with VC5 or 6 and with current Platform SDK's, define LOG4CXX_HAVE_OLD_WIN32_INTERLOCKS = 0.

        nteventlogappender.h introduced alternative definitions for HKEY, SID and HANDLE which slightly conflict with the Win32 definitions (the Win32 definitions have an "int unused;" field. To prevent conflicts, I've moved the proxy typedef's into the class, so the member functions that work with HKEY's are declared using NTEventLogAppender::HKEY's. They are appropriately cast down to ::HKEY's within nteventlogappender.cpp on calls to the Win32 API's.

        Show
        Curt Arnold added a comment - Changed macro name to LOG4CXX_HAVE_OLD_WIN32_INTERLOCKS, to build with VC5 or 6 and with current Platform SDK's, define LOG4CXX_HAVE_OLD_WIN32_INTERLOCKS = 0. nteventlogappender.h introduced alternative definitions for HKEY, SID and HANDLE which slightly conflict with the Win32 definitions (the Win32 definitions have an "int unused;" field. To prevent conflicts, I've moved the proxy typedef's into the class, so the member functions that work with HKEY's are declared using NTEventLogAppender::HKEY's. They are appropriately cast down to ::HKEY's within nteventlogappender.cpp on calls to the Win32 API's.

          People

          • Assignee:
            Curt Arnold
            Reporter:
            Curt Arnold
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development