[telepathy-qt4/master] Farsight binding: introduce TELEPATHY_QT4_FS_EXPORT, TELEPATHY_QT4_FS_NO_EXPORT macros

Simon McVittie simon.mcvittie at collabora.co.uk
Fri Dec 4 07:50:04 PST 2009


Because Windows distinguishes between Q_DECL_EXPORT and Q_DECL_IMPORT,
we need one macro like this per shared library - telepathy-qt4-farsight
needs to export its own symbols with Q_DECL_EXPORT, while importing
telepathy-qt4's symbols with Q_DECL_IMPORT.
---
 TelepathyQt4/Farsight/Makefile.am |    4 ++-
 TelepathyQt4/Farsight/channel.h   |    4 ++-
 TelepathyQt4/Farsight/global.h    |   45 +++++++++++++++++++++++++++++++++++++
 3 files changed, 51 insertions(+), 2 deletions(-)
 create mode 100644 TelepathyQt4/Farsight/global.h

diff --git a/TelepathyQt4/Farsight/Makefile.am b/TelepathyQt4/Farsight/Makefile.am
index a2c9b19..a53efad 100644
--- a/TelepathyQt4/Farsight/Makefile.am
+++ b/TelepathyQt4/Farsight/Makefile.am
@@ -1,4 +1,5 @@
 AM_CPPFLAGS = \
+	-DBUILDING_TELEPATHY_QT4_FARSIGHT \
 	-I$(top_srcdir) \
 	-I$(top_builddir) \
 	$(QTCORE_CFLAGS) \
@@ -30,4 +31,5 @@ tpqt4farsightincludedir = \
     $(includedir)/telepathy-1.0/TelepathyQt4/Farsight
 tpqt4farsightinclude_HEADERS = \
     Channel \
-    channel.h
+    channel.h \
+    global.h
diff --git a/TelepathyQt4/Farsight/channel.h b/TelepathyQt4/Farsight/channel.h
index 8276d41..528574e 100644
--- a/TelepathyQt4/Farsight/channel.h
+++ b/TelepathyQt4/Farsight/channel.h
@@ -26,6 +26,8 @@
 #error IN_TELEPATHY_QT4_HEADER
 #endif
 
+#include <TelepathyQt4/Farsight/global.h>
+
 #include <TelepathyQt4/Types>
 
 #include <telepathy-farsight/channel.h>
@@ -33,7 +35,7 @@
 namespace Tp
 {
 
-TELEPATHY_QT4_EXPORT TfChannel *createFarsightChannel(const StreamedMediaChannelPtr &channel);
+TELEPATHY_QT4_FS_EXPORT TfChannel *createFarsightChannel(const StreamedMediaChannelPtr &channel);
 
 } // Tp
 
diff --git a/TelepathyQt4/Farsight/global.h b/TelepathyQt4/Farsight/global.h
new file mode 100644
index 0000000..e0be086
--- /dev/null
+++ b/TelepathyQt4/Farsight/global.h
@@ -0,0 +1,45 @@
+/*
+ * This file is part of TelepathyQt4
+ *
+ * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2009 Nokia Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef _TelepathyQt4_Farsight_global_h_HEADER_GUARD_
+#define _TelepathyQt4_Farsight_global_h_HEADER_GUARD_
+
+#ifndef IN_TELEPATHY_QT4_HEADER
+#error IN_TELEPATHY_QT4_HEADER
+#endif
+
+#include <QtGlobal>
+
+#ifdef BUILDING_TELEPATHY_QT4_FARSIGHT
+#  define TELEPATHY_QT4_FS_EXPORT Q_DECL_EXPORT
+#else
+#  define TELEPATHY_QT4_FS_EXPORT Q_DECL_IMPORT
+#endif
+
+#if !defined(Q_OS_WIN) && defined(QT_VISIBILITY_AVAILABLE)
+#  define TELEPATHY_QT4_FS_NO_EXPORT __attribute__((visibility("hidden")))
+#endif
+
+#ifndef TELEPATHY_QT4_FS_NO_EXPORT
+#  define TELEPATHY_QT4_FS_NO_EXPORT
+#endif
+
+#endif
-- 
1.5.6.5




More information about the telepathy-commits mailing list