Reputation: 1
//cdecl function pointer
int(__cdecl* pfn)(int, int, int, int, int, int, int, int);
//stdcall function
int __stdcall HHH(int i, int i1, int i2, int i3, int i4, int i5, int i6, int i7)
{
cout << "HHH" << (i + i1 + i2 + i3 + i4 + i5 + i6 + i7) << endl;
return 1;
}
int main()
{
pfn = HHH;
cout << pfn(1, 2, 3, 4, 5, 6, 7, 8) << endl;
}
I think a stdcall function can't assign to cdecl function pointer,but in vc++2022,this worked every well. I don't know why? Thank you!
Upvotes: -2
Views: 212
Reputation: 1
Igor Tandetnik is right。i am building a 64-bit version。I have tested , if build a 32-bit version it tells me a error c2440 as PaulMcKenzie posted
Upvotes: 0