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

About this Entry

Some interesting stuff from Katie Lucas was the previous entry in this blog.

Lifetime management issues with CLR hosting is the next entry in this blog.

I usually write about C++ development on Windows platforms, but I often ramble on about other less technical stuff...

Find recent content on the main index or look in the archives to find all content.

I have other blogs...

Subscribe to feed The Server Framework - high performance server development
Subscribe to feed Lock Explorer - deadlock detection and multi-threaded performance tools
Subscribe to feed l'Hexapod - embedded electronics and robotics
Subscribe to feed MegèveSki - skiing