[smpeg] Difficulty porting SMPEG player's "update" from C to C++

Ryan C. Gordon icculus at clutteredmind.org
Thu May 22 21:00:32 EDT 2003

>   // cut-and-paste from the C programme
>   void update(SDL_Surface *screen,
> 	      Sint32 x, Sint32 y, Uint32 w, Uint32 h);

Make this "static".

static void update( /* etc... */ );

>     SMPEG_setdisplay(mpeg, screen, NULL, update); // update called here
>                                                   // by referance

you might want to specify &MPEGPlayer::update.

> Can anyone tell me what I am doing wrong?

You're trying to pass a class method to something that wants a straight C
function. Unless you specify that method to be "static", it'd expect you
to pass a "this" pointer to the function.

Being static means it can't touch any instance members of the class, though.


More information about the smpeg mailing list