Przeglądaj źródła

Correctly set export directives on non-Windows platforms.

This was nasty. On gcc with -fvisiblity=hidden, symbols marked to be
exported had "default" visibility in the shared object where they are
declared, but "hidden" visibility in shared objects where they are used.
For symbols with vague linkage (all RTTI symbols and others), only one
occurrence of the same symbol with "hidden" visibility causes the symbol
to vanish in the outputted binary.

The fixed define statements are now actually the same as they are in
Qt itself.

See http://gcc.gnu.org/wiki/Visibility
Sascha Zelzer 14 lat temu
rodzic
commit
9d40144ec9
1 zmienionych plików z 14 dodań i 4 usunięć
  1. 14 4
      Libs/ctkExport.h.in

+ 14 - 4
Libs/ctkExport.h.in

@@ -10,10 +10,20 @@
 
 #include <QtCore/qglobal.h>
 
-#if defined(@MY_LIBNAME@_EXPORTS)
- #define @MY_LIBRARY_EXPORT_DIRECTIVE@ Q_DECL_EXPORT
-#else
- #define @MY_LIBRARY_EXPORT_DIRECTIVE@ Q_DECL_IMPORT
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#  if defined(@MY_LIBNAME@_EXPORTS)
+#    define @MY_LIBRARY_EXPORT_DIRECTIVE@ Q_DECL_EXPORT
+#  else
+#    define @MY_LIBRARY_EXPORT_DIRECTIVE@ Q_DECL_IMPORT
+#  endif
+#endif
+
+#if !defined(@MY_LIBRARY_EXPORT_DIRECTIVE@)
+//#  if defined(CTK_SHARED)
+#    define @MY_LIBRARY_EXPORT_DIRECTIVE@ Q_DECL_EXPORT
+//#  else
+//#    define @MY_LIBRARY_EXPORT_DIRECTIVE@
+//#  endif
 #endif
 
 #endif