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;
}
NameComposer::~NameComposer(void)
{ }

View File

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

View File

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

View File

@ -22,10 +22,11 @@
#ifndef _WIN32
# define I2_EXPORT __attribute__ ((visibility("default")))
# define I2_IMPORT
# define I2_IMPORT __attribute__ ((visibility("default")))
#else /* _WIN32 */
# define I2_EXPORT __declspec(dllexport)
# define I2_IMPORT __declspec(dllimport)
# define I2_HIDDEN
#endif /* _WIN32 */
#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)
{
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)
@ -204,14 +218,6 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&)
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;
apiMacro = "I2_" + libName + "_API ";
}
@ -233,7 +239,7 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&)
/* TypeImpl */
m_Header << "template<>" << std::endl
<< "class TypeImpl<" << klass.Name << ">"
<< "class " << apiMacro << "TypeImpl<" << klass.Name << ">"
<< " : public Type";
if (!klass.TypeBase.empty())