似乎无法为_set_se_translator找到正确的参数
Cannot seem to come up with right parameter for _set_se_translator
我正在尝试实现_set_se_translator。我试图用以下签名编写一个函数(来自我的.cpp文件——当然,我的.h文件中也有类似的签名(:
void CIntersonBScan::trans_func(unsigned int u, EXCEPTION_POINTERS* pExp)
然后,我通过编写以下代码将此函数作为参数传递给_set_se_translator:
_set_se_translator(&CIntersonBScan::trans_func);
然后我编译我的代码并得到以下错误消息:
错误C2664:"_set_se_translator":无法将参数1从"void(__thiscall CIntersonBScan::*((unsigned int,EXCEPTION_POINTERS*("转换为"_se_translator_function">
在eh.h文件中,我找到了_se_translator_function的以下定义:
typedef void (__cdecl *_se_translator_function)(unsigned int, struct _EXCEPTION_POINTERS*);
我尝试更改trans_func的签名,但仍然收到相同的错误消息。我已经设置了/EHa编译选项。如何创建一个与_se_translator_function的签名实际匹配的函数?
typedef void (__cdecl *_se_translator_function)(unsigned int, struct _EXCEPTION_POINTERS*);
这必须是一个自由函数或静态成员函数-它不能是非静态成员函数(因为它们有一个隐藏的隐式this
参数-并且不能与_se_translator_function
匹配(。
它需要是一个独立的函数,而不是成员函数。这就是为什么类型不匹配的原因。
相关文章:
- 如何反转整数参数包
- 使用C++库在Android项目中修改gradle中的cmake参数,用于插入指令的测试
- 如何使用默认参数等选择模板专业化
- 模板参数替换失败,并且未完成隐式转换
- 具有默认模板参数的多态类的模板推导失败
- lambda参数转换为constexpr技巧,然后获取带链接的数组
- 将数组作为参数传递给函数安全吗?作为第三方职能部门,可以探索他们想要的之外的其他元素
- 函数调用中参数的顺序重要吗
- 部分定义/别名模板模板参数
- 模板-模板参数推导:三个不同的编译器三种不同的行为
- 使用不带参数的函数访问结构元素
- 基于另一个成员参数将函数调用从类传递给它的一个成员
- 如何在OMNET++中指定与命令行参数组合的输出文件名
- 如何使用Luacneneneba API正确读取字符串和表参数
- 在派生函数中指定void*参数
- 视图中的参数推导失败:take_while
- static_assert在宏中,但也可以扩展到可以用作函数参数的东西
- 使用指向成员的指针将成员函数作为参数传递
- 没有名称的C++模板参数
- 如何将enable-if与模板参数和参数包一起使用