Boost logo

Boost :

From: Anthony Williams (anthony_w.geo_at_[hidden])
Date: 2002-07-19 03:10:31


"Alan Bellingham" <alan_at_[hidden]> wrote in message
news:dnfdju8fqgvakkqclkv78a81vutv3j6ugd_at_4ax.com...
> "Anthony Williams" <anthony_w.geo_at_[hidden]>:
>
> >The only solution is to #include <windows.h> in the TU that defines the
> >class SearchPath, or to avoid every name in the windows API. Yuck.
>
> The _other_ only solution is to include a file afterwards that #undefs
> all those lovely macros and provides inline forwarding functions
> instead. Once I've finished the house move, I'll be getting a round tuit
> ... around to finishing a first draft of such an include file.
>
> e.g.:
>
> #if defined(CharLower)
> # undef CharLower
> inline char * CharLower(char * Src) { return CharLowerA(Src); }
> inline wchar_t* CharLower(wchar_t* Src) { return CharLowerW(Src); }
> #endif

Which, though it looks harmless, might affect a program that uses the
windows API --- previously CharLower named a single function, but now it
names an overloaded set. e.g.

_bstr_t fileName;

CreateFile(fileName,GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL); // oops, now
ambiguous

This is a problem, because _bstr_t has both char* and wchar* conversion
operators.

Anthony

--
Anthony Williams
Software Engineer, Nortel Networks Optical Components Ltd
The opinions expressed in this message are not necessarily those of my
employer

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk