Web lists-archives.org

Re: [Mingw-users] how can I remove the declaration of mkdir ?




Hey,

> On Sunday 03 February 2008 10:29, Vincent Torri wrote:
>> I would like to remove the declaration of mkdir, which is in io.h.
>> The reason is that I am writing a lib that is porting several
>> functions from the unix world, and I want to keep the same name. The
>> problem here is that the mingw version of mkdir has only one
>> parameter, unlike the unix one.
>>
>> So, for mkdir, there are 2 macros that guard it : _NO_OLDNAMES and
>> _UWIN
>>
>> what would be the recommended way to remove mkdir declaration ? undef
>> _NO_OLDNAMES or _UWIN ?
>
> _UWIN is in there to support AT&T's UWIN platform; you definitely do not
> want to be fiddling with it, when you are using MinGW.
>
> I faced this same issue, when I ported GNU Troff (groff).  I didn't need
> to do any more than add this #define, (which may be found in groff's
> nonposix.h header):--
>
> #if defined(__MSDOS__) || defined(__EMX__) \
>    || (defined(_WIN32) && !defined(_UWIN) && !defined(__CYGWIN__))
>  :
>  :
> # if defined(_MSC_VER) || defined(__MINGW32__)
>   :
>   :
> #  define mkdir(p,m)	_mkdir(p)
>   :
>   :
> # endif
>  :
> #endif

I tried to use your trick. In a header, I use that:

#if defined(__MSDOS__) || defined(__EMX__) || \
    (defined(_WIN32) && !defined(_UWIN) && !defined(__CYGWIN__) && 
!defined(__CEGCC__))
# if defined(_MSC_VER) || defined(__MINGW32__)
#  define open(path,flag,mode) _open((path),(flag),(mode))
#  define close(fd) _close(fd)
#  define read(fd,buffer,count) _read((fd),(buffer),(count))
#  define write(fd,buffer,count) _write((fd),(buffer),(count))
#  define unlink(filename) _unlink((filename))
#  define mkdir(p,m) _mkdir(p)
# endif
#endif

but stdio.h is also included. Hence, I have a lot of conflicts (especially 
in io.h, but also in stdio.h, like:

D:/msys/1.0/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/io.h:171:55: 
macro "mkdir" requires 2 arguments, but only 1 given

or

D:/msys/1.0/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/stdio.h:187: 
error: syntax error before '(' token


any idea about what I should do ? defining NO_OLDNAMES and _NO_OLDNAMES 
before stdio.h ?

thank you

Vincent Torri

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users