From 0661ec3993d101d0fb02bac605c979e609fdd04e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 1 Oct 1999 18:27:51 +0000 Subject: [PATCH] wxCALLBACK added, wxCOMPFUNC_CONV moved to defs.h git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3782 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/defs.h | 37 ++++++++++++++++++++++++++++++++++--- include/wx/dynarray.h | 10 +--------- include/wx/msw/listctrl.h | 2 +- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/include/wx/defs.h b/include/wx/defs.h index 42dbd1e910..4d44264966 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -297,9 +297,40 @@ typedef int wxWindowID; #define WXUNUSED(identifier) identifier #endif -/* - * Making or using wxWindows as a Windows DLL - */ +// ---------------------------------------------------------------------------- +// portable calling conventions macros +// ---------------------------------------------------------------------------- + +// wxCALLBACK should be used for the functions which are called back by +// Windows (such as compare function for wxListCtrl) +#if defined(__WXMSW__) + #if defined(__MINGW32__) + #define wxCALLBACK __attribute__((stdcall)) + #else + // both VC++ and Borland understand this + #define wxCALLBACK _stdcall + #endif +#else + // no stdcall under Unix + #define wxCALLBACK +#endif // platform + +// callling convention for the qsort(3) callback + +#if defined(__VISUALC__) + #define wxCMPFUNC_CONV _cdecl +#elif defined(__VISAGECPP__) + #define wxCMPFUNC_CONV _Optlink +#else // !Visual C++ + #define wxCMPFUNC_CONV +#endif // compiler + +// compatibility :-( +#define CMPFUNC_CONV wxCMPFUNC_CONV + +// ---------------------------------------------------------------------------- +// Making or using wxWindows as a Windows DLL +// ---------------------------------------------------------------------------- #if defined(__WXMSW__) diff --git a/include/wx/dynarray.h b/include/wx/dynarray.h index caf4b814d1..9f8f7a3ad0 100644 --- a/include/wx/dynarray.h +++ b/include/wx/dynarray.h @@ -43,15 +43,7 @@ callback compare function for quick sort must return negative value, 0 or positive value if pItem1 <, = or > pItem2 */ - -#if defined(__VISUALC__) - #define CMPFUNC_CONV _cdecl -#elif defined(__VISAGECPP__) - #define CMPFUNC_CONV _Optlink -#else // !Visual C++ - #define CMPFUNC_CONV -#endif // compiler -typedef int (CMPFUNC_CONV *CMPFUNC)(const void* pItem1, const void* pItem2); +typedef int (wxCMPFUNC_CONV *CMPFUNC)(const void* pItem1, const void* pItem2); // ---------------------------------------------------------------------------- /** diff --git a/include/wx/msw/listctrl.h b/include/wx/msw/listctrl.h index 0c59d4bb6d..ef0a992d06 100644 --- a/include/wx/msw/listctrl.h +++ b/include/wx/msw/listctrl.h @@ -173,7 +173,7 @@ public: }; // type of compare function for wxListCtrl sort operation -typedef int (CALLBACK *wxListCtrlCompare)(long item1, long item2, long sortData); +typedef int (wxCALLBACK *wxListCtrlCompare)(long item1, long item2, long sortData); class WXDLLEXPORT wxListCtrl: public wxControl { -- 2.45.2