I want to change the UUID of items that are decorated with __declspec(uuid())
at runtime.
I want to actually change the __uuidof references because there are macros
and templated classes (e.g. CComPtr) that expect to be able to use __uuidof.
So I either have to change all points where __uuidof is used to make it
retrieve the UUID at runtime without using __uuidof or I find a way to change
the actual memory address that __uuidof is using.
Is there a simple way to do this?
I've done some investigation and I have found that at least in non-optimized
builds __uuidof results in a reference to an extern "c" declaration similar
to the following:
extern "C" GUID _GUID_aa968851_31e5_406e_8673_32b01ea26ae3;
And I've found that I can change that value and in a non-optimized build it
changes all of the __uuidof references.
However, I suspect members of the compiler team will jump up and down when
they see this usage. Are you jumping yet? I'm just curious: Is it almost
guaranteed that optimizations will break attemps at doing this?
Theoretically speaking is there a way to prevent the optimizer from binding
the __uuidof value at compile time? Perhaps there's a simpler solution that
I'm missing?
Thanks!
- Don