【发布时间】:2011-03-09 15:31:31
【问题描述】:
我有一个包含一些 API 函数的库 (C++)。其中之一被声明为 __cdecl,但从 __stdcall 获得一个函数指针。比如:
typedef int (__stdcall *Func)(unsigned char* buffer);
//...
int ApiFunc(Func funcPtr); //This is __cdecl since it is an 'extern "C"' library and the calling convention is not specified
然后 - 我有一个使用此库的 C++ 可执行项目,但不调用上述 API 或使用 Func 类型。
将Func的调用约定更改为__stdcall后,出现如下编译错误:
错误 C2995: 'std::pointer_to_unary_function<_arg> std::ptr_fun(_Result (__cdecl *)(_Arg))':函数 模板已经 定义 c:\program files\microsoft 视觉工作室 8\vc\include\functional
知道会是什么吗?
提前致谢!!
【问题讨论】:
标签: c++ compiler-errors stdcall cdecl