Fix building Icinga with -fvisibility=hidden

fixes #12331
This commit is contained in:
Gunnar Beutner 2016-08-09 09:00:19 +02:00
parent b2a1541394
commit 9f425cdcaf
5 changed files with 25 additions and 12 deletions

View File

@ -690,3 +690,6 @@ ConfigObject::Ptr ConfigObject::GetZone(void) const
{ {
return m_Zone; return m_Zone;
} }
NameComposer::~NameComposer(void)
{ }

View File

@ -31,8 +31,11 @@ enum HAMode
HARunEverywhere HARunEverywhere
}; };
class NameComposer { class I2_BASE_API NameComposer
{
public: public:
virtual ~NameComposer(void);
virtual String MakeName(const String& shortName, const Object::Ptr& context) const = 0; virtual String MakeName(const String& shortName, const Object::Ptr& context) const = 0;
virtual Dictionary::Ptr ParseName(const String& name) const = 0; virtual Dictionary::Ptr ParseName(const String& name) const = 0;
}; };

View File

@ -132,7 +132,7 @@ protected:
}; };
template<typename T> template<typename T>
class TypeImpl class I2_BASE_API TypeImpl
{ {
}; };

View File

@ -22,10 +22,11 @@
#ifndef _WIN32 #ifndef _WIN32
# define I2_EXPORT __attribute__ ((visibility("default"))) # define I2_EXPORT __attribute__ ((visibility("default")))
# define I2_IMPORT # define I2_IMPORT __attribute__ ((visibility("default")))
#else /* _WIN32 */ #else /* _WIN32 */
# define I2_EXPORT __declspec(dllexport) # define I2_EXPORT __declspec(dllexport)
# define I2_IMPORT __declspec(dllimport) # define I2_IMPORT __declspec(dllimport)
# define I2_HIDDEN
#endif /* _WIN32 */ #endif /* _WIN32 */
#define TOKENPASTE(x, y) x ## y #define TOKENPASTE(x, y) x ## y

View File

@ -109,6 +109,20 @@ void ClassCompiler::HandleCode(const std::string& code, const ClassDebugInfo&)
void ClassCompiler::HandleLibrary(const std::string& library, const ClassDebugInfo& locp) void ClassCompiler::HandleLibrary(const std::string& library, const ClassDebugInfo& locp)
{ {
m_Library = library; m_Library = library;
std::string libName = m_Library;
std::locale locale;
for (std::string::size_type i = 0; i < libName.size(); i++)
libName[i] = std::toupper(libName[i], locale);
m_Header << "#ifndef I2_" << libName << "_API" << std::endl
<< "# ifdef I2_" << libName << "_BUILD" << std::endl
<< "# define I2_" << libName << "_API I2_EXPORT" << std::endl
<< "# else /* I2_" << libName << "_BUILD */" << std::endl
<< "# define I2_" << libName << "_API I2_IMPORT" << std::endl
<< "# endif /* I2_" << libName << "_BUILD */" << std::endl
<< "#endif /* I2_" << libName << "_API */" << std::endl << std::endl;
} }
unsigned long ClassCompiler::SDBM(const std::string& str, size_t len = std::string::npos) unsigned long ClassCompiler::SDBM(const std::string& str, size_t len = std::string::npos)
@ -204,14 +218,6 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&)
for (std::string::size_type i = 0; i < libName.size(); i++) for (std::string::size_type i = 0; i < libName.size(); i++)
libName[i] = std::toupper(libName[i], locale); libName[i] = std::toupper(libName[i], locale);
m_Header << "#ifndef I2_" << libName << "_API" << std::endl
<< "# ifdef I2_" << libName << "_BUILD" << std::endl
<< "# define I2_" << libName << "_API I2_EXPORT" << std::endl
<< "# else /* I2_" << libName << "_BUILD */" << std::endl
<< "# define I2_" << libName << "_API I2_IMPORT" << std::endl
<< "# endif /* I2_" << libName << "_BUILD */" << std::endl
<< "#endif /* I2_" << libName << "_API */" << std::endl << std::endl;
apiMacro = "I2_" + libName + "_API "; apiMacro = "I2_" + libName + "_API ";
} }
@ -233,7 +239,7 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&)
/* TypeImpl */ /* TypeImpl */
m_Header << "template<>" << std::endl m_Header << "template<>" << std::endl
<< "class TypeImpl<" << klass.Name << ">" << "class " << apiMacro << "TypeImpl<" << klass.Name << ">"
<< " : public Type"; << " : public Type";
if (!klass.TypeBase.empty()) if (!klass.TypeBase.empty())