Hi, I looked more deeply into this.
Microsoft with its compiler recommends to use _WIN32 and _WIN64 macros whether we build a 32 bits or a 64 bits software. (see documentation of Microsoft Developer Network - MSDN: https://msdn.microsoft.com/en-us/library/b0084kay.aspx). On the other hand with MinGW/GCC it's not as easy as it seems. As an example see this discussion : https://reviews.llvm.org/D40285 But MinGW/GCC defines effectively these macros to follow Microsoft conventions so I suggest to use something like : ================================================= --- src/lib/cfuns-c.c.old 2018-10-29 08:39:29.390556000 +0100 +++ src/lib/cfuns-c.c 2018-10-29 09:37:37.408398400 +0100 @@ -110,7 +110,7 @@ int makedir(char *path) { -#ifdef S_IRWXO +#if !defined _WIN32 && !defined _WIN64 && defined S_IRWXO return ( mkdir (path,(S_IRWXU | S_IRWXO | S_IRWXG)) ); #else return ( mkdir (path) ); ================================================= It remains the Cygwin case, I do not know how the Cygwin compiler behaves. I know the __CYGWIN__ macro can be used. Any comments appreciated. __ Greg Le mar. 16 oct. 2018 à 16:00, Grégory Vanuxem <[email protected]> a écrit : > Hello, > > I have quickly looked into this also and yes Microsoft deprecates use of > mkdir for _mkdir > See : > > But MinGW/GCC etc. are not Microsoft. I have found in the past the WIN32, > WIN and even WIN64 macros. > > Personally I'm also in favor of the dark side of the force here to > paraphrase Waldek. > Whether we use mkdir or _mkdir with or without argument what we want is > something that compiles here. > It could be a headache to play with different filesystems and their > interface, and even if I don't think Microsoft or MinGW will remove > the WIN32 macro the simpliest is I think testing code here. > > Just my two cents > > -- > Greg > > > > Le lun. 15 oct. 2018 à 13:42, oldk1331 <[email protected]> a écrit : > >> I don't see why we should not use __WIN32__ macro: >> >> 1. It will be a long time till Microsoft deprecate WIN32, even >> after that, I'm sure MS will maintain backwards compatibility for >> a long time. >> >> 2. In order to have better cross platform support, WIN32 is unavoidable. >> >> 3. BTW, MS has deprecated "mkdir", use "_mkdir" instead. >> >> On 10/14/18 12:20 AM, Waldek Hebisch wrote: >> > I have read what MinGW people wrote: they suggest puting WIN32 >> > in condition. For now that would probably work, but I do >> > not like. One reasin is because Microsoft some day may decide >> > that Windows (they seem to call all their OS products Windows) >> > is no longer WIN32 and break it that way. For me its looks >> > better to test which variant compiles -- after all we do not >> > care if system is Windows or not but if 'mkdir' with two >> > arguments works or not. Given that test is try to compile >> > our code, I am tempted to add somwhat evil logic to Makefile: >> > >> > - try to compile two argument version, if it works use the resulting >> > object file >> > - if first step failed, try one argument version, it it compiles >> > ose the resulting object file >> > - if both compiles above failed issue error message and fail >> > (which normally stops build) >> > >> >> -- >> You received this message because you are subscribed to the Google Groups >> "FriCAS - computer algebra system" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at https://groups.google.com/group/fricas-devel. >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/fricas-devel. For more options, visit https://groups.google.com/d/optout.
