いくつかの API 関数を持つライブラリ (C++) があります。そのうちの 1 つは __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,_Result,_Result(__cdecl *)(_Arg)> std::ptr_fun(_Result (__cdecl *)(_Arg))': 関数テンプレートは既に定義されています c:\program files\ Microsoft Visual Studio 8\vc\include\functional
それは何でしょうか?
前もって感謝します!!