bug-gnulib
[Top][All Lists]
Advanced

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

Re: windows platform test


From: Bruno Haible
Subject: Re: windows platform test
Date: Fri, 12 Oct 2018 00:15:35 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-137-generic; KDE/5.18.0; x86_64; ; )

Hi Assaf,

> Is there an agreed-upon #define for mingw/windows which is not cygwin?
> 
> I've seen
>    #ifdef _WIN32 && ! defined CYGWIN

This is syntactically malformed and also tests the wrong symbols.
The correct test is
     #if defined _WIN32 && ! defined __CYGWIN__

> But it seems clumsy and error-prone.

https://lists.gnu.org/archive/html/bug-gnulib/2018-08/msg00147.html

> Basically, I'm looking for a way to know that one should '#include 
> <windows.h>' and use windows api functions.

It depends on whether, for the specific feature/API, on Cygwin, you
prefer the "Cygwin way"
  - then use '#if defined _WIN32 && ! defined __CYGWIN__'
or the "native Windows way"
  - then use '#if defined _WIN32 || defined __CYGWIN__'

Bruno




reply via email to

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