The “uuid” Declaration Specifier

Syntax

Within a __declspec, this specifier is

uuid ( "ComObjectGUID" )

It is a syntax error (C2059) if the first token after uuid is not an opening parenthesis or the next token is not a string (for ComObjectGUID). It is an error (C2778) if ComObjectGUID is invalid (see below). It is a syntax error (C2059) if the token after ComObjectGUID is not a closing parenthesis.

To be valid, ComObjectGUID must either

The standard for text representation of a GUID is that of the OLE32 function CLSIDFromString: thus,

{XXXXXXXX-XXXX-XXXX-XXXXXXXXXXXX}

where each X holds the place of any hexadecimal digit (with A to F allowed in upper or lower case).

Coding Error

If ComObjectGUID, as given, has more than 128 characters, then the compiler does not attempt to interpret it as text for a GUID, but neither does it complain with an error or warning. Instead, the compiler proceeds as if given a null GUID, i.e., {00000000-0000-0000-0000-000000000000}.