Array of functions pointers using wx_DEFINE_ARRAY

Matías Szeftel mszeftel at yahoo.com.ar
Thu Feb 1 23:48:59 PST 2007


Hello all, I'm having a problem trying to make this work. It works ok on VC=
++=20
2005 express edition and it used to work in wxGTK 2.6 if I remember=20
correctly.
I'm trying to make an array of functions pointers.
I've used a typedef for the pointer function :
	typedef int (*CMPFUNC_proto)(wxActiveRecordRow**,wxActiveRecordRow**);
And I use wxArray for the array implemantation:
	WX_DEFINE_ARRAY(CMPFUNC_proto, CmpArr);

My compiler doesn't like that line.

I appreciate any hint/help you can give me,
Regards Mat=C3=ADas.

PD: Below I post some more code and spesifications.


I'm using Kubuntu Edgy.
Gcc:
Using built-in specs.
Target: i486-linux-gnu
Configured=20
with: ../src/configure -v --enable-languages=3Dc,c++,fortran,objc,obj-c++,t=
reelang --prefix=3D/usr --enable-shared --with-system-zlib --libexecdir=3D/=
usr/lib --without-included-gettext --enable-threads=3Dposix --enable-nls --=
program-suffix=3D-4.1 --enable-__cxa_atexit --enable-clocale=3Dgnu --enable=
=2Dlibstdcxx-debug --enable-mpfr --enable-checking=3Drelease=20
i486-linux-gnu
Thread model: posix
gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)      =20


//Pointer to a compare function returning an int [-1,0,1].
typedef int (*CMPFUNC_proto)(wxActiveRecordRow**,wxActiveRecordRow**);


WX_DEFINE_ARRAY_SHORT(bool , AscArr);


//////// LOOK HERE ///////////////

WX_DEFINE_ARRAY(CMPFUNC_proto, CmpArr); 	//the error is in this line, it sa=
ys:

/*
=2E./src/../include/../include/wxActiveRecord.h:130: error: invalid convers=
ion=20
from =E2=80=98int (*)(wxActiveRecordRow**, wxActiveRecordRow**)=E2=80=99 to=
 =E2=80=98const void*=E2=80=99
=2E./src/../include/../include/wxActiveRecord.h:130: error:   initializing=
=20
argument 2 of =E2=80=98void wxBaseArrayPtrVoid::resize(size_t, const void*)=
=E2=80=99

*/
//////////////////////////////

class wxActiveRecordRowSet : public ArrayOfRows{
protected:
        DatabaseLayer* m_database;
        wxString m_table;
        static CmpArr cmpArr;
        static AscArr ascArr;
        static wxString lastSort;
        static int CMPFUNC_default(wxActiveRecordRow**=20
item1,wxActiveRecordRow** item2);
        static int CMPFUNC_global(wxActiveRecordRow**=20
item1,wxActiveRecordRow** item2);
        virtual CMPFUNC_proto GetCmpFunc(const wxString& var) const;

public:
        wxActiveRecordRowSet();
        wxActiveRecordRowSet(wxActiveRecord* activeRecord);
        wxActiveRecordRowSet(DatabaseLayer* database,const wxString& table);
        virtual ~wxActiveRecordRowSet();
        virtual bool Create(wxActiveRecord* activeRecord);
        virtual bool Create(DatabaseLayer* database,const wxString& table);
        virtual bool SaveAll();
        virtual void SortBy(const wxString& sortBy);
        virtual void ReSort();
};

	

	
		
__________________________________________________ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 





More information about the wx-users mailing list