浏览代码

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 年之前
父节点
当前提交
9d40144ec9
共有 1 个文件被更改,包括 14 次插入4 次删除
  1. 14 4
      Libs/ctkExport.h.in

+ 14 - 4
Libs/ctkExport.h.in

@@ -10,10 +10,20 @@
 
 
 #include <QtCore/qglobal.h>
 #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
 
 
 #endif
 #endif