Search code examples
cwinapitags

What is proper name for the WINAPI tag in a c function?


I'm having a hard time understanding what the WINAPI tag is with respect to c.

For example:

BOOL WINAPI CreateProcessA( ...);

What exactly is this WINAPI tag, does it have more formal name, and is it part of c or implementation specific?

Sorry if my question is a bit confusing.

Many Thanks!


Solution

  • In the standard's terms, it is a storage class specifier (like "static"), a type specifier (like "unsigned"), or a type qualifier (like "const"). The difference is very roughly that if it were either kind of specifier, you could not write

    BOOL * WINAPI CreateProcessA(...);
    

    but if it were a qualifier, you could. Regardless, it is a nonstandard feature of compilers for Windows.

    (I see that other people have pointed out that in fact "WINAPI" is a macro, but it's a macro provided by the implementation, so you're supposed to treat it as a language feature and not look at what it expands to.)