[RFC] msvcrt: defines break C++ code

Francois Gouget fgouget at free.fr
Thu Jan 9 19:25:44 CST 2003

On Thu, 9 Jan 2003, Dimitrie O. Paun wrote:

> Folks,
> We have a lot of code in msvcrt headers like so:
> #define umask _umask
> #define unlink _unlink
> #define write _write
> I suggest we turn those defines into inlines, like this:
> inline int write(int fd, const void* ptr, unsigned int size) { return _write(fd, ptr, size); }
> Any other solutions?

The strange thing is that the MSVC headers simply define their
prototype, e.g.:

_CRTIMP int __cdecl umask(int);

Yet these APIs are not exported by the msvcrt library or by any other
dll that I know of. And still applications compile and link!

In fact it seems that whether the application calls umask or _umask
(even once preprocessed), MSVC will import _umask.

Anyway, replacing these defines with inline functions is fine with me.

Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
              Linux: Because rebooting is for adding new hardware

More information about the wine-devel mailing list