Support added for building using a GNU toolchain on Win32,
[platform/upstream/glib.git] / README.win32
1 For more information about the port or GLib, GTk+ and the GIMP to
2 native Windows, and pre-built binary packages, see
3 http://www.iki.fi/tml/gimp/win32/ . "Native" means that we use the
4 Win32 API only, and not any POSIX emulation layer except that provided
5 by the Microsoft runtime C library. Additionally, a pthreads emulation
6 library is used.
7
8 To build GLib on Win32, you can use either the Microsoft compiler and
9 tools, or egcs-1.1.2 running under cygwin-b20.1. Both the compiler
10 from MSVC 5.0 and from MSVC 6.0 have been used successfully. If you
11 build with egcs, note that the produced executables and DLLs do *not*
12 require the cygwin dll ("mingw32"). That's the whole point of this
13 porting effort, more or less.
14
15 The egcs support was added quite recently, but seems to work in all
16 respects. Debugging with gdk works.
17
18 Before building you must get the pthreads library for Windows from
19 http://sourceware.cygnus.com/pthreads-win32/. The pthreads-win32
20 snapshot from 1999-04-07 is the one that should be used. Edit the
21 location of the pthreads library and include files in
22 makefile.msc.
23
24 If using the Microsoft toolchain, build with `nmake -f
25 makefile.msc`. Install with `nmake -f makefile.msc install`.
26 If using egcs, build using `make -f makefile.cygwin`.
27
28 To test the GLib functions, go to the tests subdirectory and enter
29 `nmake -f makefile.msc check`.
30
31 If you would want to use the cygwin tools to generate executables that
32 *do* usethe cygwin runtime the normal Unix configuration method should
33 work as if on Unix (knock on wood).
34
35 With a little work, it might be possible to use the ./configure
36 mechanism also with a "mingw32" configuration.
37
38 The following preprocessor macros are used for conditional compilation 
39 related to Win32:
40
41 - WIN32 is defined when compiling for the Win32 platform, regardless
42   if using the X11 or Win32 windowing API (in the case of GLib, this
43   dimension isn't significant), regardless whether using a more or
44   less complete POSIX emulation runtime layer (like Cygwin) or not.
45
46 - NATIVE_WIN32 is defined when compiling for Win32, *and* without
47   any POSIX emulation, other that to the extent provided by the
48   bundled Microsoft C library and the pthreads-win32 library. For
49   instance, pathnames are in the native Windows syntax.
50
51 The Win32 port uses the combination with both of those on.
52
53 Additionally, there are the compiler-specific macros:
54 - _MSC_VER is defined when using the Microsoft compiler
55 - __GNUC__ is defined when using GCC (i.e. egcs)
56
57 Some of the usage of these macros was a bit mixed up, and had to be
58 straightened out when adding the gcc support. In particular, I used to
59 check for _MSC_VER in some places where I really wanted to check for
60 the Microsoft C library, and those checks has now been changed to
61 NATIVE_WIN32.
62
63 The pthreads for Win32 package that the thread support uses isn't
64 quite ready yet, and thus threads really should not be relied upon.