如何在__declspec中传递动态值(uuid(" ComObjectGUID"))

时间:2012-10-02 11:45:48

标签: c++ uuid declspec

在我的代码中,这非常正常:

class __declspec(uuid("842E12D3-1F2C-435D-8426-BE42150AF4DB")) guid;

但是我没有传递一个staitc值,而是想传递这样的东西,但它会产生编译错误:

string result("64ca9bdb-08d2-45f7-c526-8fcaa8d5abd1");
class __declspec(uuid(result)) guid; 

//"result" will have dynamic value and that's why want to pass it a variable rather than hard coding the value

有人可以建议我如何实现这一目标。

谢谢, 萨南

1 个答案:

答案 0 :(得分:2)

这看起来像是在编译时使用的东西。所以没有办法传递动态值。