1

In my code this works absolutely fine :

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

but instead of passing a staitc value I want to pass something like this, but it gives compilation error :

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

Can someone please suggest me how to achieve this.

Thanks, Sanam

Tony The Lion
  • 61,704
  • 67
  • 242
  • 415
sanam_bl
  • 299
  • 1
  • 7
  • 14

1 Answers1

2

This looks like something that is used at compile time. So there is no way to pass a dynamic value.

ThiefMaster
  • 310,957
  • 84
  • 592
  • 636
  • but is it possible to pass a variable instead of passing the actual value. Because I need to pass the "result" which will have the actual value. – sanam_bl Oct 02 '12 at 12:52
  • Hi,It's true that it is not possible to pass dynamic value during compile time, but it is possible to pass it during run time like this : UUID uuid; string result("{822412D3-745C-535D-8676-BE41230AF4DB}"); UuidFromString((RPC_CSTR)result.c_str( ), &uuid); then u can pass or assign the uuid whereever u want. – sanam_bl Oct 04 '12 at 13:05