bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sys_stat.in.h should include direct.h rather than io.h


From: Bruno Haible
Subject: Re: sys_stat.in.h should include direct.h rather than io.h
Date: Sun, 11 Apr 2010 00:26:05 +0200
User-agent: KMail/1.9.9

Hello Roman,

> sys_stat.in.h includes <io.h> in order to get the _mkdir function  
> declaration. This works in MinGW, but MinGW-w64's io.h [1] doesn't declare  
> _mkdir, direct.h [2] does. OTOH, MinGW's direct.h [3] includes io.h [4],  
> where _mkdir is declared, so including <direct.h> will work there as well.
> 
> Microsoft's documentation [5] also states that _mkdir is declared in  
> <direct.h> (albeit that's not for the runtime version MinGWs use).

Thanks for these pointers. I'm applying this presumed fix.


2010-04-10  Bruno Haible  <address@hidden>

        mkdir: Make it work on mingw64.
        * lib/sys_stat.in.h: Include <direct.h> together with <io.h>.
        Reported by Roman Donchenko (Роман Донченко) <address@hidden>.

--- lib/sys_stat.in.h.orig      Sun Apr 11 00:24:55 2010
+++ lib/sys_stat.in.h   Sun Apr 11 00:24:50 2010
@@ -56,7 +56,8 @@
 /* Before doing "#define mkdir rpl_mkdir" below, we need to include all
    headers that may declare mkdir().  */
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-# include <io.h>
+# include <io.h>     /* mingw32, mingw64 */
+# include <direct.h> /* mingw64 */
 #endif
 
 #ifndef S_IFMT
@@ -455,7 +456,8 @@
 #else
 /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
    Additionally, it declares _mkdir (and depending on compile flags, an
-   alias mkdir), only in the nonstandard <io.h>, which is included above.  */
+   alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
+   which are included above.  */
 # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 
 static inline int




reply via email to

[Prev in Thread] Current Thread [Next in Thread]