thanks for the help Wysota.
Another question: I've lotsa data in this struct now, that I'm passing to the static callback function. I also need to include a pointer in the struct to a member function... so I can call that function from within the callback. I've looked around on the web but haven't found a solution that fits my particular situation: so far I get various compile errors. I'm trying various things like this:
//in header:
class Coin3dWindow : public SoQtExaminerViewer {
private:
void fly0_stop(void);
typedef struct {
void (*flyStop)(void);
// void (*Coin3dWindow::flyStop)();
} MyFlyData;
MyFlyData *myflydata0;
.
.
.
}
class Coin3dWindow : public SoQtExaminerViewer {
private:
void fly0_stop(void);
typedef struct {
void (*flyStop)(void);
// void (*Coin3dWindow::flyStop)();
} MyFlyData;
MyFlyData *myflydata0;
.
.
.
}
To copy to clipboard, switch view to plain text mode
// then in a Coin3dWindow member function I do
myflydata0 = new MyFlyData;
myflydata0->flyStop = &fly0_stop;
myflydata0 = new MyFlyData;
myflydata0->flyStop = &fly0_stop;
To copy to clipboard, switch view to plain text mode
this is where I get the compile error:
error C2276: '&' : illegal operation on bound member function expression
if I drop the '&'
myflydata0->flyStop = fly0_stop;
i get:
error C3867: 'Model::fly0_stop' : function call missing argument list; use '&Model::fly0_stop' to create a pointer to a member
error C2440: '=' : cannot convert from 'void (_thiscall Model::*)(void)' to 'void (_cdecl *)(void)'
so if I change it to:
myflydata0->flyStop = &Model::fly0_stop;
myflydata0->flyStop = &Model::fly0_stop;
To copy to clipboard, switch view to plain text mode
I just get that last error message (the C2440, but not the C3867 obviously). Anyhow, this is the way I've seen it explained on the web... but I'm not sure why it won't compile. Any ideas?
BTW, fly0_stop(void) is currently empty except for a single qDebug("hit");.
Bookmarks