What are __in and WSAAPI?

I saw the following in the socket definition in msdn:

SOCKET WSAAPI socket(
  __in  int af,
  __in  int type,
  __in  int protocol
);

What does the __in prefix mean?

and what is WSAAPI?

+5
source share
3 answers

__in (and friends) determine the intended use of each parameter, so calls to this function can be mechanically verified.

See http://msdn.microsoft.com/en-us/library/aa383701(v=vs.85).aspx on how to activate verification.

http://msdn.microsoft.com/en-us/library/ms235402.aspx describes a modern alternative.

WSAAPI , . , , .

+4

, . , , ( /).

WSAAPI - API Microsoft. .

+4

, , WSAAPI , WSAAPI Winsock2.h :

#define WSAAPI                  FAR PASCAL

minwindef.h:

#define FAR                 far
#define far

#if (!defined(_MAC)) && ((_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED))
#define pascal __stdcall
#else
#define pascal
#endif

#ifdef _MAC
#ifdef _68K_
#define PASCAL      __pascal
#else
#define PASCAL
#endif
#elif (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
#define PASCAL      __stdcall
#else
#define PASCAL      pascal
#endif

. _MSC_VER 800 Visual ++ 1.0, .

So it looks like if you write Mac code and _68K_, you get the __pascal calling convention. If you are using Visual C ++> = 1.0 and developing for Windows, this is the __stdcall calling convention. Otherwise, it is either __stdcall or nothing, depending on whether _STDCALL_SUPPORTED is defined.

So basically WSAAPI probably evaluates __stdcall on your machine.

0
source

All Articles