Uploaded image for project: 'Log4cxx'
  1. Log4cxx
  2. LOGCXX-456

Some header defined getters and setters are wrongly removed by C++-Builder 10 Seattle.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.11.0
    • 0.11.0
    • None
    • None
    • Embarcadero C++-Builder 10 Seattle

    Description

      I'm currently building the log library log4cxx in C++-Builder 10 Seattle as a static lib. All went well until I came to the tests, where linker errors about unresolved externals occured, even though I added the lib. The interesting thing is that I'm literelly building every available CPP file for the lib, except the tests of course, and the source class for the missing method is build as well and other methods of that class are available in the lib. It's only one method missing. This method and all the other responsible for the unresolved external seem to be defined in the header only, because they are only simple getters or setters. But the same class has other getters and setters defined exactly the same way in the header as well and those are not part of the linker errors.

      The only difference I found so far is that the mentioned methods are not used within the lib, but only externally in the tests. That's why those getters and setters are declared public. The following is one example:

      public:
      [...]
          const LevelPtr& getThreshold() const { return threshold; }
      

      If I copy the definition to the CPP file, the unresolved external is removed at least for that method.

      const LevelPtr& AppenderSkeleton::getThreshold() const
      {
          return threshold;
      }
      

      This looks like that the method is optimized away even though it's declared public and on static lib level one can't know who uses those methods.

      While this looks like an error in my IDE, the fix for this is easy and shouldn't harm anybody, so I'm changing the methods mentioned in my error messages and document the problem here for later reference and findings.

      Attachments

        Activity

          People

            tschoening Thorsten Schöning
            tschoening Thorsten Schöning
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: