userData: explicit cast from void* to struct*

nicolas baurin nicolas.baurin at univ-orleans.fr
Thu May 18 11:01:48 EDT 2000


Hello to all galib people,

after my former message about handling user data with galib, a galib
member drives me to the userData member fonction of the Gagenome class
which is of void * type. This enables me to pass my user data under
struct form :
typedef struct {*int;double *}MyData;
MyData data;
GA1DBinaryStringGenome genome(Rol, Objective,(void*)&data);

My problem is now to reach these data in the Objective function :

    MyData* dataF;
    GA1DBinaryStringGenome & genome = (GA1DBinaryStringGenome &)g;
    dataF=genome.userData();

where the compilator tells me to define an explicit cast to pass from
void * to MyData. If anyone could show me the way
Cordialement,

--
Nicolas Baurin

Doctorant
Institut de Chimie Organique et Analytique, UPRES-A 6005
Université d'Orléans, BP 6759
45067 ORLEANS Cedex 2, France
Tel: (33+) 2 38 49 45 77





More information about the galib mailing list