[tz] [PATCH] Allow use of <direct.h> from Microsoft Windows to fix mkdir() parameters

Ian Abbott abbotti at mev.co.uk
Fri Feb 26 14:11:51 UTC 2016

On 26/02/2016 11:39, Paul Eggert wrote:
> Ian Abbott wrote:
>> This patch makes "private.h" optionally include <direct.h> (and also
>> <io.h>, due
>> to MinGW's behavior), controlled by the HAVE_DIRECT_H macro, and defines
>> mkdir(path, mode) as macro calling _mkdir(path).
> Thanks, I like this better, but better yet let's put this in zic.c since
> it's the only file that needs the mkdir substitute.
>> There are some warnings about 'tzname' being redeclared without dllimport
>> attribute, when compiling zdump.c and localtime.c
> We should be able to fix this by not redeclaring tzname. How about the
> attached patch? I've installed it in the experimental repository on
> GitHub. It also tries to fix the link/symlink problem you mentioned in
> your other email. It takes a somewhat more-ambitious approach, in an
> attempt to fix some longstanding minor glitches on POSIX hosts too,
> while we're at it.

It builds in a MinGW-w64 Win32 or Win64 environment with the following 
command line:


I still get the warnings about the dllimport attribute on 'tzname'.  I 
suppose that can't be helped since we're using the tzname[] defined in 
"localtime.c", rather than the one from Microsoft's C runtime library 
DLL.  Here's an extract of the build showing the warnings:

cc -DTZDIR=\"/usr/local/etc/zoneinfo\" -DHAVE_SYS_WAIT_H=0 
-DHAVE_POSIX_DECLS=0   -c -o zdump.o zdump.c
zdump.c:247:15: warning: 'tzname' redeclared without dllimport 
attribute: previous dllimport ignored [-Wattributes]
  extern char * tzname[];
cc -DTZDIR=\"/usr/local/etc/zoneinfo\" -DHAVE_SYS_WAIT_H=0 
-DHAVE_POSIX_DECLS=0   -c -o localtime.o localtime.c
localtime.c:181:10: warning: 'tzname' redeclared without dllimport 
attribute: previous dllimport ignored [-Wattributes]
  char *   tzname[2] = {

If I make the 'date' executable, there are similar warnings when 
compiling "date.c" and "strftime.c".

-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-

More information about the tz mailing list