You are missing the __stdcall
calling convention on the function pointer type, which comes from the WINAPI
macro. The compiler is therefore assuming the default __cdecl
calling convention for this pointer. The two calling conventions are not compatible.
Consider creating this typedef:
typedef int WINAPI (*WSAStartupCallback)(WORD, LPWSADATA);
Then declare your function like this:
int StartWinSock(WSAStartupCallback wsaStartup)
{
}
You should then be able to call this function with the external WSAStartup
pointer.