]> granicus.if.org Git - icinga2/commitdiff
Fix building Icinga with -fvisibility=hidden
authorGunnar Beutner <gunnar.beutner@netways.de>
Tue, 9 Aug 2016 07:00:19 +0000 (09:00 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Tue, 9 Aug 2016 07:00:19 +0000 (09:00 +0200)
fixes #12331

lib/base/configobject.cpp
lib/base/configobject.ti
lib/base/type.hpp
lib/base/visibility.hpp
tools/mkclass/classcompiler.cpp

index 84071acd58dc52180d42b9406c66697ef98dc481..7db364fba99e3e792ac1484f305acd094cf3ee59 100644 (file)
@@ -690,3 +690,6 @@ ConfigObject::Ptr ConfigObject::GetZone(void) const
 {
        return m_Zone;
 }
+
+NameComposer::~NameComposer(void)
+{ }
index bd2ff914819d11b0e8ecbeb6767df53da71b467b..57a760e63c71828a1596e03972974c9045f49bb9 100644 (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;
 };
index f1d80498ac1e494e4f9fe83f5a3c24fdc6b5dc81..eced9e70fd21e55fc7dd437ac36dc8857a80d305 100644 (file)
@@ -132,7 +132,7 @@ protected:
 };
 
 template<typename T>
-class TypeImpl
+class I2_BASE_API TypeImpl
 {
 };
 
index 7e5270e155766b06d18705bcce2648d6dbd453b8..8a2afc25d1b6e3199b7857f8336aa1a46ff042be 100644 (file)
 
 #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
index 4c7136437d3467d02610a1c4460e70420c614fcc..80c0b107d15f8016365d0d6936de6bc18e1cfdc7 100644 (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())