Search code examples
c++declspec

What does __declspec(uuid(" ComObjectGUID ")) expand to?


I have a piece of code that uses Microsoft-specific extension to the C++:

interface __declspec(uuid("F614FB00-6702-11d4-B0B7-0050BABFC904"))
ICalculator : public IUnknown
{ 
    //...
};

What does this sentence expand to? How can I rewrite it with ANSI C++?


Solution

  • It's not a macro so it doesn't "expand" to anything. It merely decorates the type with a given UUID in the object file metadata, which can then be extracted later with the __uuidof operator.