Wondering how LOG4CPLUS_EXPORT works in Android, i encounter an error when linking the log4cplus library, and the error is:
error: undefined reference to 'log4cplus::FileAppender::FileAppender(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, bool, bool)'
Using nm i can see the symbol is there, don't know why link failed, and i check the source code find that FileAppender is not defined with LOG4CPLUS_EXPORT, while RollingFileAppender is, so i switched using RollingFileAppender and everything works fine now.
My question is: How the exporting works? I see in config.hxx
# if defined (INSIDE_LOG4CPLUS)
# define LOG4CPLUS_EXPORT LOG4CPLUS_DECLSPEC_EXPORT
# define LOG4CPLUS_EXPORT LOG4CPLUS_DECLSPEC_IMPORT
# endif // defined (INSIDE_LOG4CPLUS)#ifndef
LOG4CPLUS_DECLSPEC_EXPORT /* empty */#endif
I know that there may be some way to do this like _attribute_
((visibility("hidden"))), but i haven't find any .
What is the magic here?
Thanks in advance!