From 063811edc49edbbae71d474a5df72968118e05b8 Mon Sep 17 00:00:00 2001 From: matthias Date: Sat, 30 Dec 2017 14:28:09 -0800 Subject: [PATCH] Solved the clang/MacOS startup failure and menu issue 1.) Startup issue: This is solved by making sure templates with virtual functions are made visible in the DSO. This way, dynamic_cast is possible across DSO's. Scary: clang/MacOS wants the forward declarations be declared visible as well. 2.) Menu issue: The best solution is to have only one QMenuBar. The navigator now gets a synthetic menu bar composed of QToolButtons. --- src/ant/ant/antCommon.h | 2 +- src/buddies/src/bd/bdCommon.h | 2 +- src/db/db/dbBox.h | 2 +- src/db/db/dbCommon.h | 2 +- src/db/db/dbEdge.h | 2 +- src/db/db/dbEdgePair.h | 2 +- src/db/db/dbPoint.h | 2 +- src/db/db/dbPolygon.h | 4 +-- src/db/db/dbText.h | 2 +- src/db/db/dbTrans.h | 8 ++--- src/db/db/dbVector.h | 2 +- src/drc/drc/drcCommon.h | 2 +- src/edt/edt/edtCommon.h | 2 +- src/ext/ext/extCommon.h | 2 +- src/gsi/gsi/gsiClass.h | 10 +++--- src/gsi/gsi/gsiCommon.h | 2 +- src/gsi/gsi/gsiExpression.h | 4 +-- src/gsi/gsi/gsiObject.h | 2 +- src/gsi/gsi/gsiObjectHolder.h | 2 +- src/gsi/gsi/gsiTypes.h | 22 ++++++------ src/gsiqt/gsiQtCommon.h | 2 +- src/img/img/imgCommon.h | 2 +- src/lay/lay/layCommon.h | 2 +- src/lay/lay/layNativePlugin.h | 2 +- src/lay/lay/layNavigator.cc | 5 +-- src/lay/lay/layNavigator.h | 4 +-- src/laybasic/laybasic/layAbstractMenu.cc | 46 +++++++++++++++++++----- src/laybasic/laybasic/layAbstractMenu.h | 3 +- src/laybasic/laybasic/laybasicCommon.h | 2 +- src/lym/lym/lymCommon.h | 2 +- src/pya/pya/pyaCommon.h | 2 +- src/pya/pya/pyaConvert.h | 4 +-- src/pyastub/pyaCommon.h | 2 +- src/rba/rba/rbaCommon.h | 2 +- src/rbastub/rbaCommon.h | 2 +- src/rdb/rdb/rdbCommon.h | 2 +- src/tl/tl/tlCommon.h | 26 +++++++++++++- src/tl/tl/tlEvents.h | 12 +++---- src/tl/tl/tlEventsVar.h | 12 +++---- src/tl/tl/tlObject.h | 6 ++-- src/tl/tl/tlVariant.h | 6 ++-- 41 files changed, 140 insertions(+), 84 deletions(-) diff --git a/src/ant/ant/antCommon.h b/src/ant/ant/antCommon.h index a748222a9..93991d9b4 100644 --- a/src/ant/ant/antCommon.h +++ b/src/ant/ant/antCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define ANT_PUBLIC __attribute__ ((visibility ("default"))) # define ANT_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/buddies/src/bd/bdCommon.h b/src/buddies/src/bd/bdCommon.h index fc9120f92..33fd0c01e 100644 --- a/src/buddies/src/bd/bdCommon.h +++ b/src/buddies/src/bd/bdCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define BD_PUBLIC __attribute__ ((visibility ("default"))) # define BD_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/db/db/dbBox.h b/src/db/db/dbBox.h index 53965fe85..2a95b9f90 100644 --- a/src/db/db/dbBox.h +++ b/src/db/db/dbBox.h @@ -57,7 +57,7 @@ class ArrayRepository; */ template -struct box +struct DB_PUBLIC box { typedef C coord_type; typedef box box_type; diff --git a/src/db/db/dbCommon.h b/src/db/db/dbCommon.h index 620893506..5d31d991c 100644 --- a/src/db/db/dbCommon.h +++ b/src/db/db/dbCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define DB_PUBLIC __attribute__ ((visibility ("default"))) # define DB_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/db/db/dbEdge.h b/src/db/db/dbEdge.h index ba8cf2568..91f866935 100644 --- a/src/db/db/dbEdge.h +++ b/src/db/db/dbEdge.h @@ -42,7 +42,7 @@ template class generic_repository; class ArrayRepository; template -class edge +class DB_PUBLIC edge { public: typedef C coord_type; diff --git a/src/db/db/dbEdgePair.h b/src/db/db/dbEdgePair.h index 5ff1a9542..e00f91bdf 100644 --- a/src/db/db/dbEdgePair.h +++ b/src/db/db/dbEdgePair.h @@ -40,7 +40,7 @@ namespace db { template -class edge_pair +class DB_PUBLIC edge_pair { public: typedef C coord_type; diff --git a/src/db/db/dbPoint.h b/src/db/db/dbPoint.h index 3c11d0534..4d07d0ea6 100644 --- a/src/db/db/dbPoint.h +++ b/src/db/db/dbPoint.h @@ -43,7 +43,7 @@ template class vector; */ template -class point +class DB_PUBLIC point { public: typedef C coord_type; diff --git a/src/db/db/dbPolygon.h b/src/db/db/dbPolygon.h index 46ea03ec8..27c22ecbe 100644 --- a/src/db/db/dbPolygon.h +++ b/src/db/db/dbPolygon.h @@ -1364,7 +1364,7 @@ private: */ template -class polygon +class DB_PUBLIC polygon { public: typedef C coord_type; @@ -2324,7 +2324,7 @@ private: */ template -class simple_polygon +class DB_PUBLIC simple_polygon { public: typedef C coord_type; diff --git a/src/db/db/dbText.h b/src/db/db/dbText.h index 94cb83d8e..598742575 100644 --- a/src/db/db/dbText.h +++ b/src/db/db/dbText.h @@ -222,7 +222,7 @@ private: */ template -class text +class DB_PUBLIC text { public: typedef C coord_type; diff --git a/src/db/db/dbTrans.h b/src/db/db/dbTrans.h index 07b49bc5c..21bf9d763 100644 --- a/src/db/db/dbTrans.h +++ b/src/db/db/dbTrans.h @@ -42,8 +42,8 @@ namespace tl { namespace db { -template class complex_trans; -template class simple_trans; +template class DB_PUBLIC complex_trans; +template class DB_PUBLIC simple_trans; template class disp_trans; template class fixpoint_trans; @@ -1035,7 +1035,7 @@ operator<< (std::ostream &os, const disp_trans &t) */ template -class simple_trans +class DB_PUBLIC simple_trans : public fixpoint_trans { public: @@ -1439,7 +1439,7 @@ operator<< (std::ostream &os, const simple_trans &t) * type used internally for representing the floating-point members). */ template -class complex_trans +class DB_PUBLIC complex_trans { public: typedef I coord_type; diff --git a/src/db/db/dbVector.h b/src/db/db/dbVector.h index e70928e6c..69411553b 100644 --- a/src/db/db/dbVector.h +++ b/src/db/db/dbVector.h @@ -45,7 +45,7 @@ template class point; */ template -class vector +class DB_PUBLIC vector { public: typedef C coord_type; diff --git a/src/drc/drc/drcCommon.h b/src/drc/drc/drcCommon.h index f93d63d98..be76a31dd 100644 --- a/src/drc/drc/drcCommon.h +++ b/src/drc/drc/drcCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define DRC_PUBLIC __attribute__ ((visibility ("default"))) # define DRC_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/edt/edt/edtCommon.h b/src/edt/edt/edtCommon.h index 22c53a329..9bdda5552 100644 --- a/src/edt/edt/edtCommon.h +++ b/src/edt/edt/edtCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define EDT_PUBLIC __attribute__ ((visibility ("default"))) # define EDT_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/ext/ext/extCommon.h b/src/ext/ext/extCommon.h index 1b6de2e2d..3c05d13ee 100644 --- a/src/ext/ext/extCommon.h +++ b/src/ext/ext/extCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define EXT_PUBLIC __attribute__ ((visibility ("default"))) # define EXT_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/gsi/gsi/gsiClass.h b/src/gsi/gsi/gsiClass.h index b40407f28..600c85abc 100644 --- a/src/gsi/gsi/gsiClass.h +++ b/src/gsi/gsi/gsiClass.h @@ -116,7 +116,7 @@ void _var_user_read_impl (T * /*a*/, tl::Extractor & /*ex*/, tl::false_tag) * @brief A VariantUserClassBase specialization that links GSI classes and Variant classes */ template -class VariantUserClass +class GSI_PUBLIC VariantUserClass : public tl::VariantUserClass, private VariantUserClassImpl { public: @@ -551,7 +551,7 @@ public: * the given methods. */ template -class ClassExt +class GSI_PUBLIC ClassExt : public ClassBase { public: @@ -708,7 +708,7 @@ struct adaptor_type_info * or to call it's methods in some generic way. */ template -class Class +class GSI_PUBLIC Class : public ClassBase { public: @@ -937,7 +937,7 @@ public: * a subclass of the parent. */ template -class ChildClass +class GSI_PUBLIC ChildClass : public Class { public: @@ -970,7 +970,7 @@ public: * a subclass of the parent. */ template -class ChildSubClass +class GSI_PUBLIC ChildSubClass : public SubClass { public: diff --git a/src/gsi/gsi/gsiCommon.h b/src/gsi/gsi/gsiCommon.h index c6a5d2d6d..2b83715cc 100644 --- a/src/gsi/gsi/gsiCommon.h +++ b/src/gsi/gsi/gsiCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define GSI_PUBLIC __attribute__ ((visibility ("default"))) # define GSI_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/gsi/gsi/gsiExpression.h b/src/gsi/gsi/gsiExpression.h index 331ea8c59..b7b63a11a 100644 --- a/src/gsi/gsi/gsiExpression.h +++ b/src/gsi/gsi/gsiExpression.h @@ -34,9 +34,9 @@ namespace gsi { -class ClassBase; +class GSI_PUBLIC ClassBase; struct NoAdaptorTag; -template class Class; +template class GSI_PUBLIC Class; /** * @brief The implementation delegate for the VariantUserClass diff --git a/src/gsi/gsi/gsiObject.h b/src/gsi/gsi/gsiObject.h index 6204088b3..f16c2c17b 100644 --- a/src/gsi/gsi/gsiObject.h +++ b/src/gsi/gsi/gsiObject.h @@ -35,7 +35,7 @@ namespace gsi { -class ClassBase; +class GSI_PUBLIC ClassBase; /** * @brief Definition of the client indexes diff --git a/src/gsi/gsi/gsiObjectHolder.h b/src/gsi/gsi/gsiObjectHolder.h index f9bd695ef..a3bb140a7 100644 --- a/src/gsi/gsi/gsiObjectHolder.h +++ b/src/gsi/gsi/gsiObjectHolder.h @@ -30,7 +30,7 @@ namespace gsi { -class ClassBase; +class GSI_PUBLIC ClassBase; /** * @brief Implements an object holder diff --git a/src/gsi/gsi/gsiTypes.h b/src/gsi/gsi/gsiTypes.h index 4e8dea99d..64a46a93b 100644 --- a/src/gsi/gsi/gsiTypes.h +++ b/src/gsi/gsi/gsiTypes.h @@ -55,19 +55,19 @@ namespace gsi // --------------------------------------------------------------------------------- // Type system of GSI -class SerialArgs; -class VectorAdaptor; -class MapAdaptor; -class StringAdaptor; -class VariantAdaptor; -class ClassBase; +class GSI_PUBLIC SerialArgs; +class GSI_PUBLIC VectorAdaptor; +class GSI_PUBLIC MapAdaptor; +class GSI_PUBLIC StringAdaptor; +class GSI_PUBLIC VariantAdaptor; +class GSI_PUBLIC ClassBase; struct NoAdaptorTag; -template class Class; +template class GSI_PUBLIC Class; template struct ClassTag; -template class IterAdaptor; -template class IterPtrAdaptor; -template class ConstIterPtrAdaptor; -template class FreeIterAdaptor; +template class GSI_PUBLIC IterAdaptor; +template class GSI_PUBLIC IterPtrAdaptor; +template class GSI_PUBLIC ConstIterPtrAdaptor; +template class GSI_PUBLIC FreeIterAdaptor; template const ClassBase *cls_decl (); /** diff --git a/src/gsiqt/gsiQtCommon.h b/src/gsiqt/gsiQtCommon.h index ebb74197e..990775a70 100644 --- a/src/gsiqt/gsiQtCommon.h +++ b/src/gsiqt/gsiQtCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define GSIQT_PUBLIC __attribute__ ((visibility ("default"))) # define GSIQT_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/img/img/imgCommon.h b/src/img/img/imgCommon.h index af8c183fe..411442a14 100644 --- a/src/img/img/imgCommon.h +++ b/src/img/img/imgCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define IMG_PUBLIC __attribute__ ((visibility ("default"))) # define IMG_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/lay/lay/layCommon.h b/src/lay/lay/layCommon.h index b14cfdfb4..b4ae166ab 100644 --- a/src/lay/lay/layCommon.h +++ b/src/lay/lay/layCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define LAY_PUBLIC __attribute__ ((visibility ("default"))) # define LAY_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/lay/lay/layNativePlugin.h b/src/lay/lay/layNativePlugin.h index 8ecb4194c..46d0f94d2 100644 --- a/src/lay/lay/layNativePlugin.h +++ b/src/lay/lay/layNativePlugin.h @@ -55,7 +55,7 @@ typedef void (*klp_init_func_t) (void (**autorun) (), void (**autorun_early) (), # if defined _WIN32 || defined __CYGWIN__ # define KLP_PUBLIC __declspec(dllexport) # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define KLP_PUBLIC __attribute__ ((visibility ("default"))) # else # define KLP_PUBLIC diff --git a/src/lay/lay/layNavigator.cc b/src/lay/lay/layNavigator.cc index 40a1a0ea4..a527d71d8 100644 --- a/src/lay/lay/layNavigator.cc +++ b/src/lay/lay/layNavigator.cc @@ -30,7 +30,7 @@ #include "imgService.h" #include -#include +#include #include namespace lay @@ -443,7 +443,8 @@ Navigator::Navigator (MainWindow *main_window) { setObjectName (QString::fromUtf8 ("navigator")); - mp_menu_bar = new QMenuBar (this); + mp_menu_bar = new QFrame (this); + mp_menu_bar->setFrameShape (QFrame::NoFrame); mp_menu_bar->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Preferred); mp_view = new LayoutView (0, false, mp_main_window, this, "navigator", LayoutView::LV_Naked + LayoutView::LV_NoZoom + LayoutView::LV_NoServices + LayoutView::LV_NoGrid); diff --git a/src/lay/lay/layNavigator.h b/src/lay/lay/layNavigator.h index db8a715f5..19dd944fc 100644 --- a/src/lay/lay/layNavigator.h +++ b/src/lay/lay/layNavigator.h @@ -33,7 +33,7 @@ class QCloseEvent; class QShowEvent; -class QMenuBar; +class QFrame; class QLabel; namespace lay @@ -102,7 +102,7 @@ private: MainWindow *mp_main_window; LayoutView *mp_view; QLabel *mp_placeholder_label; - QMenuBar *mp_menu_bar; + QFrame *mp_menu_bar; LayoutView *mp_source_view; NavigatorService *mp_service; tl::DeferredMethod m_do_view_changed; diff --git a/src/laybasic/laybasic/layAbstractMenu.cc b/src/laybasic/laybasic/layAbstractMenu.cc index 9bc65effa..40577bbba 100644 --- a/src/laybasic/laybasic/layAbstractMenu.cc +++ b/src/laybasic/laybasic/layAbstractMenu.cc @@ -37,6 +37,7 @@ #include #include #include +#include #include @@ -903,31 +904,61 @@ AbstractMenu::make_exclusive_group (const std::string &name) } void -AbstractMenu::build_detached (const std::string &name, QMenuBar *mbar) +AbstractMenu::build_detached (const std::string &name, QFrame *mbar) { + // Clean up the menu bar before rebuilding + if (mbar->layout ()) { + delete mbar->layout (); + } + QObjectList children = mbar->children (); + for (QObjectList::const_iterator c = children.begin (); c != children.end (); ++c) { + if (dynamic_cast (*c)) { + delete *c; + } + } + + QHBoxLayout *menu_layout = new QHBoxLayout (mbar); + menu_layout->setMargin (0); + mbar->setLayout (menu_layout); + AbstractMenuItem *item = find_item_exact ("@@" + name); tl_assert (item != 0); - mbar->clear (); - for (std::list::iterator c = item->children.begin (); c != item->children.end (); ++c) { if (c->has_submenu ()) { + QToolButton *menu_button = new QToolButton (mbar); + menu_layout->addWidget (menu_button); + menu_button->setAutoRaise (true); + menu_button->setPopupMode (QToolButton::MenuButtonPopup); + menu_button->setText (tl::to_qstring (c->action ().get_title ())); + if (c->menu () == 0) { - c->set_menu (mbar->addMenu (tl::to_qstring (c->action ().get_title ()))); - c->set_action (Action (new ActionHandle (c->menu ()->menuAction (), false)), true); + QMenu *menu = new QMenu (mbar); + menu_button->setMenu (menu); + c->set_menu (menu); + c->set_action (Action (new ActionHandle (menu->menuAction (), false)), true); } else { - mbar->addMenu (c->menu ()); + menu_button->setMenu (c->menu ()); } build (c->menu (), c->children); } else { - mbar->addAction (c->action ().qaction ()); + + QAction *action = c->action ().qaction (); + + QToolButton *menu_button = new QToolButton (mbar); + menu_layout->addWidget (menu_button); + menu_button->setAutoRaise (true); + menu_button->setDefaultAction (action); + } } + + menu_layout->addStretch (1); } void @@ -1521,4 +1552,3 @@ AbstractMenu::collect_group (std::vector &grp, const std::string &n } } - diff --git a/src/laybasic/laybasic/layAbstractMenu.h b/src/laybasic/laybasic/layAbstractMenu.h index e5ece7024..ecbf9091f 100644 --- a/src/laybasic/laybasic/layAbstractMenu.h +++ b/src/laybasic/laybasic/layAbstractMenu.h @@ -42,6 +42,7 @@ #include "tlObject.h" #include "laybasicCommon.h" +class QFrame; class QMenuBar; class QToolBar; class QMenu; @@ -681,7 +682,7 @@ public: * @param name The name of the detached menu, without the "@" * @param mbar The menu bar into which to build the menu */ - void build_detached (const std::string &name, QMenuBar *mbar); + void build_detached (const std::string &name, QFrame *mbar); /** * @brief Get the reference to a QMenu object diff --git a/src/laybasic/laybasic/laybasicCommon.h b/src/laybasic/laybasic/laybasicCommon.h index 13c438ce4..18cc3946c 100644 --- a/src/laybasic/laybasic/laybasicCommon.h +++ b/src/laybasic/laybasic/laybasicCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define LAYBASIC_PUBLIC __attribute__ ((visibility ("default"))) # define LAYBASIC_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/lym/lym/lymCommon.h b/src/lym/lym/lymCommon.h index 7cd484ea5..3465ff4f4 100644 --- a/src/lym/lym/lymCommon.h +++ b/src/lym/lym/lymCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define LYM_PUBLIC __attribute__ ((visibility ("default"))) # define LYM_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/pya/pya/pyaCommon.h b/src/pya/pya/pyaCommon.h index 8d0e9756b..8af7f41ee 100644 --- a/src/pya/pya/pyaCommon.h +++ b/src/pya/pya/pyaCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define PYA_PUBLIC __attribute__ ((visibility ("default"))) # define PYA_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/pya/pya/pyaConvert.h b/src/pya/pya/pyaConvert.h index 48c55d023..051ea4b28 100644 --- a/src/pya/pya/pyaConvert.h +++ b/src/pya/pya/pyaConvert.h @@ -36,8 +36,8 @@ namespace gsi { - class ClassBase; - class ArgType; + class GSI_PUBLIC ClassBase; + class GSI_PUBLIC ArgType; } namespace pya diff --git a/src/pyastub/pyaCommon.h b/src/pyastub/pyaCommon.h index 8d0e9756b..8af7f41ee 100644 --- a/src/pyastub/pyaCommon.h +++ b/src/pyastub/pyaCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define PYA_PUBLIC __attribute__ ((visibility ("default"))) # define PYA_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/rba/rba/rbaCommon.h b/src/rba/rba/rbaCommon.h index 886648672..60510c739 100644 --- a/src/rba/rba/rbaCommon.h +++ b/src/rba/rba/rbaCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define RBA_PUBLIC __attribute__ ((visibility ("default"))) # define RBA_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/rbastub/rbaCommon.h b/src/rbastub/rbaCommon.h index 886648672..60510c739 100644 --- a/src/rbastub/rbaCommon.h +++ b/src/rbastub/rbaCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define RBA_PUBLIC __attribute__ ((visibility ("default"))) # define RBA_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/rdb/rdb/rdbCommon.h b/src/rdb/rdb/rdbCommon.h index d241ed53f..7cec4f6ed 100644 --- a/src/rdb/rdb/rdbCommon.h +++ b/src/rdb/rdb/rdbCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define RDB_PUBLIC __attribute__ ((visibility ("default"))) # define RDB_LOCAL __attribute__ ((visibility ("hidden"))) # else diff --git a/src/tl/tl/tlCommon.h b/src/tl/tl/tlCommon.h index 91f2d67cc..7a6d202ee 100644 --- a/src/tl/tl/tlCommon.h +++ b/src/tl/tl/tlCommon.h @@ -35,7 +35,7 @@ # else -# if __GNUC__ >= 4 +# if __GNUC__ >= 4 || defined(__clang__) # define TL_PUBLIC __attribute__ ((visibility ("default"))) # define TL_LOCAL __attribute__ ((visibility ("hidden"))) # else @@ -45,4 +45,28 @@ # endif +// NOTE: this is required because we have some forward declarations to +// gsi::Class and gsi::ClassBase in tlVariant.h. +// TODO: there should not be any dependency of tl on gsi. +# if defined _WIN32 || defined __CYGWIN__ + +# ifdef MAKE_GSI_LIBRARY +# define GSI_PUBLIC __declspec(dllexport) +# else +# define GSI_PUBLIC __declspec(dllimport) +# endif +# define GSI_LOCAL + +# else + +# if __GNUC__ >= 4 || defined(__clang__) +# define GSI_PUBLIC __attribute__ ((visibility ("default"))) +# define GSI_LOCAL __attribute__ ((visibility ("hidden"))) +# else +# define GSI_PUBLIC +# define GSI_LOCAL +# endif + +# endif + #endif diff --git a/src/tl/tl/tlEvents.h b/src/tl/tl/tlEvents.h index c077dafea..08af5a123 100644 --- a/src/tl/tl/tlEvents.h +++ b/src/tl/tl/tlEvents.h @@ -114,12 +114,12 @@ void handle_event_exception (std::exception &ex); * @endcode */ -template class event_function_base; -template class event_function; -template class event_function_with_data; -template class generic_event_function; -template class generic_event_function_with_data; -template class event; +template class TL_PUBLIC event_function_base; +template class TL_PUBLIC event_function; +template class TL_PUBLIC event_function_with_data; +template class TL_PUBLIC generic_event_function; +template class TL_PUBLIC generic_event_function_with_data; +template class TL_PUBLIC event; typedef event<> Event; #define _COUNT 0 diff --git a/src/tl/tl/tlEventsVar.h b/src/tl/tl/tlEventsVar.h index d84e90c84..cca4c78e3 100644 --- a/src/tl/tl/tlEventsVar.h +++ b/src/tl/tl/tlEventsVar.h @@ -31,7 +31,7 @@ #endif template <_TMPLARGS> -class event_function_base<_TMPLARGLISTP> +class TL_PUBLIC event_function_base<_TMPLARGLISTP> : public tl::Object { public: @@ -42,7 +42,7 @@ public: }; template <_JOIN(class T, _TMPLARGS)> -class event_function +class TL_PUBLIC event_function : public event_function_base<_TMPLARGLIST> { public: @@ -71,7 +71,7 @@ private: }; template -class event_function_with_data +class TL_PUBLIC event_function_with_data : public event_function_base<_TMPLARGLIST> { public: @@ -101,7 +101,7 @@ private: }; template <_JOIN(class T, _TMPLARGS)> -class generic_event_function +class TL_PUBLIC generic_event_function : public event_function_base<_TMPLARGLIST> { public: @@ -131,7 +131,7 @@ private: }; template -class generic_event_function_with_data +class TL_PUBLIC generic_event_function_with_data : public event_function_base<_TMPLARGLIST> { public: @@ -162,7 +162,7 @@ private: }; template <_TMPLARGS> -class event<_TMPLARGLISTP> +class TL_PUBLIC event<_TMPLARGLISTP> { public: typedef event_function_base<_TMPLARGLISTP> func; diff --git a/src/tl/tl/tlObject.h b/src/tl/tl/tlObject.h index e9f9beca8..e786d19a5 100644 --- a/src/tl/tl/tlObject.h +++ b/src/tl/tl/tlObject.h @@ -240,7 +240,7 @@ private: * This class represents a weak or shared pointer for the given type T. */ template -class weak_or_shared_ptr +class TL_PUBLIC weak_or_shared_ptr : public WeakOrSharedPtr { public: @@ -376,7 +376,7 @@ public: * See description of tl::Object for details. */ template -class weak_ptr +class TL_PUBLIC weak_ptr : public weak_or_shared_ptr { public: @@ -404,7 +404,7 @@ public: * See description of tl::Object for details. */ template -class shared_ptr +class TL_PUBLIC shared_ptr : public weak_or_shared_ptr { public: diff --git a/src/tl/tl/tlVariant.h b/src/tl/tl/tlVariant.h index a20c0a528..3e1f6074c 100644 --- a/src/tl/tl/tlVariant.h +++ b/src/tl/tl/tlVariant.h @@ -42,9 +42,9 @@ namespace gsi { - class ClassBase; + class GSI_PUBLIC ClassBase; struct NoAdaptorTag; - template class Class; + template class GSI_PUBLIC Class; template const ClassBase *cls_decl (); } @@ -102,7 +102,7 @@ protected: * We will employ RTTI to identify a type through that base class. */ template -class VariantUserClass +class TL_PUBLIC VariantUserClass : public VariantUserClassBase { public: