Thorsten Schöning created LOGCXX-456:
----------------------------------------

             Summary: Some header defined getters and setters are wrongly 
removed by C++-Builder 10 Seattle.
                 Key: LOGCXX-456
                 URL: https://issues.apache.org/jira/browse/LOGCXX-456
             Project: Log4cxx
          Issue Type: Bug
    Affects Versions: 0.11.0
         Environment: Embarcadero C++-Builder 10 Seattle
            Reporter: Thorsten Schöning
            Assignee: Thorsten Schöning


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: 

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

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

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

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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to