On 02.03.2011 12:31, MacArthur, Ian (SELEX GALILEO, UK) wrote:
>> <li>__CYGWIN__ is defined when FLTK runs on the MS-Windows OS but uses
>> the Xlib graphics system. When __CYGWIN__ is defined, WIN32
>> is also defined.
>
>
> Is this strictly true?
No, this is wrong.
> I mean, does the __CYGWIN__ define only bound X11-on-win32 builds?
> Or does it also bound other uses of the cygwin runtime?
It is completely independent of the GUI setting. It means that the
resulting executable must be linked with the cygwin dll, and thus
the code can take advantage of Cygwin's POSIX emulation layer.
FLTK, compiled under Cygwin, can run with native Windows GUI (GDI)
and/or with X11 as its GUI system (but X11 requires the Cygwin dll,
see below).
> I mean, are there cases where the __CYGWIN__ define might bound other
> cygwin features (like, um, I don't know, maybe fork() or something...)
> under win32, even if the GUI layer was win32 rather than X11 ???
Yep, see above, fork() is a good example.
> Juat asking, I eally do not know what the __CYGWIN__ stuff is in fltk
> these days!
Generally it is simple, but the /implications/ in the FLTK code are not
so easy to use correctly (but see below: what is correct?).
The simple part:
(1) --enable-cygwin enables the Cygwin-specific compiler, and this
defines __CYGWIN__. This implies also to link with Cygwin's
runtime system and cygwin1.dll.
w/o --enable-cygwin, the included MinGW gcc (3.x) is used by
adding the compiler switch -mno-cygwin.
With --enable-cygwin alone, WIN32 is still defined.
(2) --enable-x11 is only useful when --enable-cygwin is used too,
and this /undefines/ WIN32, and thus the FLTK code uses the
X11-specific code path everywhere.
The not-so-easy part:
(1) __CYGWIN__ implies a Windows build, and thus sizeof(wchar_t) == 2
and not 4 as on (all ?) other platforms. This is true even if we
use X11 and Xft, as we saw recently when we changed the (Xft)
illegal UTF-8 character handling.
(2) Which kind of file access to use? Windows-specific calls or the
usual Unix (POSIX'y?) functions?
(3) Other system functions: use native Windows functions (same question
as above)
... and maybe more. There are places in the code where you can read
#if defined(WIN32) && !defined(__CYGWIN__)
and this is often useful, but I don't know if this is always the
"correct" (or best) usage.
Recently it became even more difficult for users, because the Cygwin
guys removed the -mno-cygwin option from their standard gcc (4.x),
and you must use a MinGW *cross-compiler* (!) to build native Windows
applications. I tried it for building native 64-bit apps, and it works
(with some restrictions), but this is not easy to manage for new users.
That's why I also changed to MinGW for my own development system, and
that's what I recommend now to other Windows users (unless they want
to use an IDE).
Albrecht
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev