编译器错误 C2357

“identifier”:必须是类型为“type”的函数

代码声明的 atexit 函数版本与编译器内部声明的版本不匹配。 如下声明 atexit

int __cdecl atexit(void (__cdecl *)());

有关详细信息,请参阅 init_seg

下面的示例生成 C2357:

// C2357.cpp
// compile with: /c
// C2357 expected
#pragma warning(disable : 4075)
// Uncomment the following line to resolve.
// int __cdecl myexit(void (__cdecl *)());
#pragma init_seg(".mine$m",myexit)