[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Lua 5.2.0 (work1) now available
- From: David Burgess <dabsoft@...>
- Date: Sun, 10 Jan 2010 10:38:46 +1100
I am not a guru, but let me relate my experiences:
1) if you are going to use windows.h it should be the first header, this
is because the windows headers modify macros used by the RTL, I have
read MS documentation on this (but cant remember where).
This means that loadlib.c *needs* an in the module #ifdef to include
windows.h as the first header. I vaguely remember specific problems with
modules that include <io.h>, so in writing a Lua library for windows the
header order is impoortant.
2) One can argue that VC_EXTRALEAN WIN32LEAN_AND_MEAN STRICT should be
on the compiler command line invocation not in the headers e/g
/DSTRICT=1 /DWIN32_LEAN_AND_MEAN=1 /DVC_EXTRALEAN=1
and these should be considered depending on what you are building
/D_CONSOLE or /D_WINDOWS\
/D_MBCS or not \
Alexander Gladysh wrote:
Or just include windows.h where it is needed in loadlib.c under #elif
defined(LUA_DL_DLL) and not in the luaconf.h file.
Works without problems for me.
Much better. windows.h is a serious kitchen-sink header.
Agreed. #include <windows.h> has no business out in my public header chain.
I've expected that, at least, it would be framed by #if
defined(LUA_CORE) checks, but no, it goes right to public. Nasty.
Furthermore, I remember that including windows.h without extra defines
is a bad idea.
When I coded for Windows, I always used to do at least this:
Much less hassle. (Especially without min and max defined as macroses.)
Also, this (outdated) article suggests there can be even more useful defines:
Perhaps some Win32 guru would enlighten us more?