git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38292
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#endif // defined( __VISUALC__ )
#endif // defined( __VISUALC__ )
+/*
+ Note: the outer helper class _WX_LIST_HELPER_##liT below is a workaround
+ for mingw 3.2.3 compiler bug that prevents a static function of liT class
+ from being exported into dll. A minimal code snippet reproducing the bug:
+
+ struct WXDLLEXPORT Foo
+ {
+ static void Bar();
+ struct SomeInnerClass
+ {
+ friend class Foo; // comment this out to make it link
+ };
+ ~Foo()
+ {
+ Bar();
+ }
+ };
+
+ The program does not link under mingw_gcc 3.2.3 producing undefined
+ reference to Foo::Bar() function
+ */
+
+// the real wxList-class declaration
#define WX_DECLARE_LIST_XO(elT, liT, decl) \
#define WX_DECLARE_LIST_XO(elT, liT, decl) \
+ class WXDLLEXPORT _WX_LIST_HELPER_##liT \
+ { \
+ typedef elT _WX_LIST_ITEM_TYPE_##liT; \
+ public: \
+ static void DeleteFunction( _WX_LIST_ITEM_TYPE_##liT X ); \
+ }; \
+ \
VC6_WORKAROUND(elT, liT, decl) \
decl liT : public std::list<elT> \
{ \
private: \
bool m_destroy; \
VC6_WORKAROUND(elT, liT, decl) \
decl liT : public std::list<elT> \
{ \
private: \
bool m_destroy; \
- private: \
- typedef elT _WX_LIST_ITEM_TYPE_##liT; \
- static void DeleteFunction( _WX_LIST_ITEM_TYPE_##liT X ); \
public: \
decl compatibility_iterator \
{ \
public: \
decl compatibility_iterator \
{ \
void Erase( const compatibility_iterator& i ) \
{ \
if ( m_destroy ) \
void Erase( const compatibility_iterator& i ) \
{ \
if ( m_destroy ) \
- DeleteFunction( i->GetData() ); \
+ _WX_LIST_HELPER_##liT::DeleteFunction( i->GetData() ); \
erase( i.m_iter ); \
} \
bool DeleteNode( const compatibility_iterator& i ) \
erase( i.m_iter ); \
} \
bool DeleteNode( const compatibility_iterator& i ) \
void Clear() \
{ \
if ( m_destroy ) \
void Clear() \
{ \
if ( m_destroy ) \
- std::for_each( begin(), end(), DeleteFunction ); \
+ std::for_each( begin(), end(), \
+ _WX_LIST_HELPER_##liT::DeleteFunction ); \
clear(); \
} \
/* Workaround for broken VC6 std::list::sort() see above */ \
clear(); \
} \
/* Workaround for broken VC6 std::list::sort() see above */ \
#if wxUSE_STL
#undef WX_DEFINE_LIST
#if wxUSE_STL
#undef WX_DEFINE_LIST
- #define WX_DEFINE_LIST(name) \
- void name::DeleteFunction( _WX_LIST_ITEM_TYPE_##name X ) \
- { \
- delete X; \
+ #define WX_DEFINE_LIST(name) \
+ void _WX_LIST_HELPER_##name::DeleteFunction( _WX_LIST_ITEM_TYPE_##name X ) \
+ { \
+ delete X; \
WX_DEFINE_LIST(wxObjectList)
// with wxUSE_STL wxStringList contains wxString objects, not pointers
WX_DEFINE_LIST(wxObjectList)
// with wxUSE_STL wxStringList contains wxString objects, not pointers
-void wxStringListBase::DeleteFunction( wxString WXUNUSED(X) )
+void _WX_LIST_HELPER_wxStringListBase::DeleteFunction( wxString WXUNUSED(X) )