Crapness in mscoree.h


I'm playing around with hosting the CLR in C++ at present and have come across a bit of crapness in the mscoree.h file...

#if (_MSC_VER < 1300 || _WIN32_WINNT < 0x0500)
typedef VOID ( __stdcall *WAITORTIMERCALLBACK )(
    PVOID __MIDL_0011,
    BOOL __MIDL_0012);

#endif // (_MSC_VER < 1300 || _WIN32_WINNT < 0x0500)

This effectively says, if you're using VC6 or you're compiling for less than v5 of Windows NT then you don't have this typedef so here it is... Unfortunately, if you're compiling with VC6 but you're using the platform SDK then you already have that typedef in winbase.h and, well, mscoree.h wont compile...

It's a pity that versions of the Platform SDK aren't identifiable by a #define as this would make it easy to solve this kind of problem (and lots of others!) in a neat and maintainable way, but...

So far the best I've come up with is to wrap the inclusion of the real mscoree.h in my own include and check for use of VC6 and lie about the compilers age to mscoree.h... Anyone got any better suggestions?

Leave a comment