I am trying to implement _set_se_translator. I tried to write a function with the following signature (from my .cpp file - of course, I have a similar signature in my .h file):
void CIntersonBScan::trans_func(unsigned int u, EXCEPTION_POINTERS* pExp)
I then pass this function as a parameter to _set_se_translator by writing the following code:
_set_se_translator(&CIntersonBScan::trans_func);
I then compile my code and get the following error message:
error C2664: '_set_se_translator': cannot convert parameter 1 from 'void(__thiscall CIntersonBScan::*)(unsigned int,EXCEPTION_POINTERS *)' to '_se_translator_function'
In the eh.h file, I found the following definition for _se_translator_function:
typedef void (__cdecl *_se_translator_function)(unsigne开发者_开发技巧d int, struct _EXCEPTION_POINTERS*);
I tried varying the signature of trans_func and still got the same error message. I already set the /EHa compile option. How to I create a function that would actually match the signature of _se_translator_function?
typedef void (__cdecl *_se_translator_function)(unsigned int, struct _EXCEPTION_POINTERS*);
This must be a free function, or a static member function - it cannot be a non-static member function (because these have a hidden implicit this
parameter - and cannot match _se_translator_function
).
It needs to be a free standing function, not a member function. That is why the types don't match.
精彩评论