From a497618a568bfdd1059e3f51b560a98fd25b1003 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 12 Oct 1999 23:57:40 +0000 Subject: [PATCH] 1. DLL compilation fixes (wrong WXDLLEXPORT placement) in db.h/cpp 2. dummy typedef added to gsocket.c - trans unit can't be empty 3. WX_DEFINE_EXPORTED_ARRAY & friends appear git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3947 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/db.h | 2 +- include/wx/dynarray.h | 51 +++++++++++++++++++++++++++------------ include/wx/msw/dcclient.h | 2 +- include/wx/msw/listbox.h | 2 +- include/wx/msw/notebook.h | 2 +- include/wx/msw/treectrl.h | 2 +- include/wx/textfile.h | 2 +- src/common/db.cpp | 4 +-- src/common/mimetype.cpp | 2 +- src/msw/gsocket.c | 10 +++++--- 10 files changed, 51 insertions(+), 28 deletions(-) diff --git a/include/wx/db.h b/include/wx/db.h index 90f70ffa35..c624086c26 100644 --- a/include/wx/db.h +++ b/include/wx/db.h @@ -443,7 +443,7 @@ class CstructTablesInUse : public wxObject // for other code segments to use, or close all of them when the application has // completed. -wxDB* WXDLLEXPORT GetDbConnection(DbStuff *pDbStuff); +wxDB WXDLLEXPORT *GetDbConnection(DbStuff *pDbStuff); bool WXDLLEXPORT FreeDbConnection(wxDB *pDb); void WXDLLEXPORT CloseDbConnections(void); int WXDLLEXPORT NumberDbConnectionsInUse(void); diff --git a/include/wx/dynarray.h b/include/wx/dynarray.h index 8e69a43ee2..a3c4017ada 100644 --- a/include/wx/dynarray.h +++ b/include/wx/dynarray.h @@ -165,9 +165,9 @@ private: // { ((wxBaseArray *)this)->operator=((const wxBaseArray&)src); // so using a temporary variable instead. // ---------------------------------------------------------------------------- -#define _WX_DEFINE_ARRAY(T, name) \ +#define _WX_DEFINE_ARRAY(T, name, classexp) \ typedef int (CMPFUNC_CONV *CMPFUNC##T)(T *pItem1, T *pItem2); \ -class WXDLLEXPORT name : public wxBaseArray \ +classexp name : public wxBaseArray \ { \ public: \ name() \ @@ -228,9 +228,9 @@ public: \ // { ((wxBaseArray *)this)->operator=((const wxBaseArray&)src); // so using a temporary variable instead. // ---------------------------------------------------------------------------- -#define _WX_DEFINE_SORTED_ARRAY(T, name) \ +#define _WX_DEFINE_SORTED_ARRAY(T, name, classexp) \ typedef int (CMPFUNC_CONV *SCMPFUNC##T)(T pItem1, T pItem2); \ -class WXDLLEXPORT name : public wxBaseArray \ +classexp name : public wxBaseArray \ { \ public: \ name(SCMPFUNC##T fn) \ @@ -274,9 +274,9 @@ private: \ // ---------------------------------------------------------------------------- // see WX_DECLARE_OBJARRAY and WX_DEFINE_OBJARRAY // ---------------------------------------------------------------------------- -#define _WX_DECLARE_OBJARRAY(T, name) \ +#define _WX_DECLARE_OBJARRAY(T, name, classexp) \ typedef int (CMPFUNC_CONV *CMPFUNC##T)(T** pItem1, T** pItem2); \ -class WXDLLEXPORT name : public wxBaseArray \ +classexp name : public wxBaseArray \ { \ public: \ name() { } \ @@ -340,15 +340,17 @@ private: \ @memo declare and define array class 'name' containing elements of type 'T' */ -#define WX_DEFINE_ARRAY(T, name) typedef T _A##name; \ - _WX_DEFINE_ARRAY(_A##name, name) +#define WX_DEFINE_ARRAY(T, name) \ + typedef T _A##name; \ + _WX_DEFINE_ARRAY(_A##name, name, class) /** This macro does the same as WX_DEFINE_ARRAY except that the array will be sorted with the specified compare function. */ -#define WX_DEFINE_SORTED_ARRAY(T, name) typedef T _A##name; \ - _WX_DEFINE_SORTED_ARRAY(_A##name, name) +#define WX_DEFINE_SORTED_ARRAY(T, name) \ + typedef T _A##name; \ + _WX_DEFINE_SORTED_ARRAY(_A##name, name, class) /** This macro generates a new objarrays class which owns the objects it @@ -385,8 +387,10 @@ private: \ @memo declare objarray class 'name' containing elements of type 'T' */ -#define WX_DECLARE_OBJARRAY(T, name) typedef T _L##name; \ - _WX_DECLARE_OBJARRAY(_L##name, name) +#define WX_DECLARE_OBJARRAY(T, name) \ + typedef T _L##name; \ + _WX_DECLARE_OBJARRAY(_L##name, name, class) + /** To use an objarray class you must @@ -407,18 +411,32 @@ private: \ #define WX_DEFINE_OBJARRAY(name) "don't forget to include arrimpl.cpp!" //@} +// these macros do the same thing as the WX_XXX ones above, but should be used +// inside the library for user visible classes because otherwise they wouldn't +// be visible from outside (when using wxWindows as DLL under Windows) +#define WX_DEFINE_EXPORTED_ARRAY(T, name) \ + typedef T _A##name; \ + _WX_DEFINE_ARRAY(_A##name, name, class WXDLLEXPORT) + +#define WX_DEFINE_SORTED_EXPORTED_ARRAY(T, name) \ + typedef T _A##name; \ + _WX_DEFINE_SORTED_ARRAY(_A##name, name, class WXDLLEXPORT) + +#define WX_DECLARE_EXPORTED_OBJARRAY(T, name) \ + typedef T _L##name; \ + _WX_DECLARE_OBJARRAY(_L##name, name, class WXDLLEXPORT) + // ---------------------------------------------------------------------------- /** @name Some commonly used predefined arrays */ -// # overhead if not used? // ---------------------------------------------------------------------------- //@{ /** @name ArrayInt */ -WX_DEFINE_ARRAY(int, wxArrayInt); +WX_DEFINE_EXPORTED_ARRAY(int, wxArrayInt); /** @name ArrayLong */ -WX_DEFINE_ARRAY(long, wxArrayLong); +WX_DEFINE_EXPORTED_ARRAY(long, wxArrayLong); /** @name ArrayPtrVoid */ -WX_DEFINE_ARRAY(void *, wxArrayPtrVoid); +WX_DEFINE_EXPORTED_ARRAY(void *, wxArrayPtrVoid); //@} //@} @@ -443,5 +461,6 @@ WX_DEFINE_ARRAY(void *, wxArrayPtrVoid); \ array.Empty(); \ } + #endif // _DYNARRAY_H diff --git a/include/wx/msw/dcclient.h b/include/wx/msw/dcclient.h index 21d1a42e53..997f2cfc6e 100644 --- a/include/wx/msw/dcclient.h +++ b/include/wx/msw/dcclient.h @@ -30,7 +30,7 @@ // this one if used by wxPaintDC only struct WXDLLEXPORT wxPaintDCInfo; -WX_DECLARE_OBJARRAY(wxPaintDCInfo, wxArrayDCInfo); +WX_DECLARE_EXPORTED_OBJARRAY(wxPaintDCInfo, wxArrayDCInfo); // ---------------------------------------------------------------------------- // DC classes diff --git a/include/wx/msw/listbox.h b/include/wx/msw/listbox.h index faf42ede5f..6d1d8c0ba6 100644 --- a/include/wx/msw/listbox.h +++ b/include/wx/msw/listbox.h @@ -26,7 +26,7 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxListBoxNameStr; // define the array of list box items #include - WX_DEFINE_ARRAY(wxOwnerDrawn *, wxListBoxItemsArray); + WX_DEFINE_EXPORTED_ARRAY(wxOwnerDrawn *, wxListBoxItemsArray); #endif diff --git a/include/wx/msw/notebook.h b/include/wx/msw/notebook.h index 265274a036..8b94e5ce8f 100644 --- a/include/wx/msw/notebook.h +++ b/include/wx/msw/notebook.h @@ -34,7 +34,7 @@ class WXDLLEXPORT wxWindow; // array of notebook pages typedef wxWindow WXDLLEXPORT wxNotebookPage; // so far, any window can be a page -WX_DEFINE_ARRAY(wxNotebookPage *, wxArrayPages); +WX_DEFINE_EXPORTED_ARRAY(wxNotebookPage *, wxArrayPages); // ---------------------------------------------------------------------------- // wxNotebook diff --git a/include/wx/msw/treectrl.h b/include/wx/msw/treectrl.h index b193782490..c143a0bf39 100644 --- a/include/wx/msw/treectrl.h +++ b/include/wx/msw/treectrl.h @@ -122,7 +122,7 @@ protected: long m_itemId; }; -WX_DEFINE_ARRAY(wxTreeItemId, wxArrayTreeItemIds); +WX_DEFINE_EXPORTED_ARRAY(wxTreeItemId, wxArrayTreeItemIds); // ---------------------------------------------------------------------------- // wxTreeItemData is some (arbitrary) user class associated with some item. The diff --git a/include/wx/textfile.h b/include/wx/textfile.h index 84042ca019..6c617bb624 100644 --- a/include/wx/textfile.h +++ b/include/wx/textfile.h @@ -45,7 +45,7 @@ enum wxTextFileType wxTextFileType_Os2 // 'CR' 'LF' }; -WX_DEFINE_ARRAY(wxTextFileType, ArrayFileType); +WX_DEFINE_EXPORTED_ARRAY(wxTextFileType, ArrayFileType); class WXDLLEXPORT wxTextFile { diff --git a/src/common/db.cpp b/src/common/db.cpp index 553b712a8a..30f8556094 100644 --- a/src/common/db.cpp +++ b/src/common/db.cpp @@ -84,7 +84,7 @@ #include "wx/db.h" #endif -DbList* WXDLLEXPORT PtrBegDbList = 0; +DbList WXDLLEXPORT *PtrBegDbList = 0; #if __WXDEBUG__ > 0 #if wxMAJOR_VERSION == 2 @@ -1728,7 +1728,7 @@ DBMS wxDB::Dbms(void) /********** GetDbConnection() **********/ -wxDB* WXDLLEXPORT GetDbConnection(DbStuff *pDbStuff) +wxDB WXDLLEXPORT *GetDbConnection(DbStuff *pDbStuff) { DbList *pList; diff --git a/src/common/mimetype.cpp b/src/common/mimetype.cpp index c7c12b22e2..e1d64f89b0 100644 --- a/src/common/mimetype.cpp +++ b/src/common/mimetype.cpp @@ -119,7 +119,7 @@ private: m_ext; }; -WX_DECLARE_OBJARRAY(wxFileTypeInfo, wxArrayFileTypeInfo); +WX_DECLARE_EXPORTED_OBJARRAY(wxFileTypeInfo, wxArrayFileTypeInfo); #include "wx/arrimpl.cpp" WX_DEFINE_OBJARRAY(wxArrayFileTypeInfo); diff --git a/src/msw/gsocket.c b/src/msw/gsocket.c index 11f17d00a9..88e8c99a5c 100644 --- a/src/msw/gsocket.c +++ b/src/msw/gsocket.c @@ -1350,11 +1350,15 @@ GSocketError GAddress_UNIX_GetPath(GAddress *address, char *path, size_t sbuf) return GSOCK_INVADDR; } +#else /* !wxUSE_SOCKETS */ -#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ - - +/* + * translation unit shouldn't be empty, so include this typedef to make the + * compiler (VC++ 6.0, for example) happy + */ +typedef (*wxDummy)(); +#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ /* Diferencias con la version Unix: * - El descriptor es SOCKET y no int -- 2.45.2