I have two possibly simple questions as far as the code below is concerned:
#include <windows.h>//IN and OUT prefixes are defined here
typedef int(__cdecl *FOO)(IN int input);
int my_int_func(IN int x) {
return x;
}
int main() {
int res = 0;
FOO foo = &my_int_func;
res = (*foo)(5);
return 0;
}
The code actually works flawlessly. Here are the questions:
1) What does the IN prefix mean in the typedef row? The prefix is defined in windows.h header. The code hangs if the header is omitted.
2) If I change __cdecl calling convention to __stdcall, the compiler underlines the &my_int_func and outputs the error message "Error: a value of type "int (*)(int x)" cannot be used to initialize an entity of type "FOO." My question is why?
I use MS Visual Studio Ultimate 2013.