c++ - Pass a __thiscall to a function typedef -
this question has answer here:
i don't know how word this, i'll try best explain in code:
typedef void( *examplefn )( pvoid p1, pvoid p2, pvoid p3 );  struct example {     void examplefunction( pvoid p1, pvoid p2, pvoid p3 )     {         // example's members     } };  example example; examplefn examplefn = example.examplefunction;   so, error:
error c2440 '=': cannot convert 'void (__thiscall example::* )(pvoid,pvoid,pvoid)' 'examplefn'   i understand problem, example::examplefunction __thiscall , examplefn not, how can go this?
how have example object examplefn-like function in can use object's members?
you need define youre function-pointer correctly. it's member-function pointer, needs this:
typedef void(example::*examplefn )( pvoid p1, pvoid p2, pvoid p3 );   the __thiscall call-convention of member-functions, that's set automatically.
you defined pointer plain-function doesn't work. doesn't concern call-convetion really.
Comments
Post a Comment