source: trunk/gcc/boehm-gc/doc/README.win32@ 3003

Last change on this file since 3003 was 2, checked in by bird, 22 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 7.3 KB
Line 
1The collector has at various times been compiled under Windows 95 & NT,
2with the original Microsoft SDK, with Visual C++ 2.0, 4.0, and 6, with
3the GNU win32 environment, with Borland 4.5, with Watcom C, and recently
4with the Digital Mars compiler. It is likely that some of these have been
5broken in the meantime. Patches are appreciated.
6
7It runs under both win32s and win32, but with different semantics.
8Under win32, all writable pages outside of the heaps and stack are
9scanned for roots. Thus the collector sees pointers in DLL data
10segments. Under win32s, only the main data segment is scanned.
11(The main data segment should always be scanned. Under some
12versions of win32s, other regions may also be scanned.)
13Thus all accessible objects should be accessible from local variables
14or variables in the main data segment. Alternatively, other data
15segments (e.g. in DLLs) may be registered with the collector by
16calling GC_init() and then GC_register_root_section(a), where
17a is the address of some variable inside the data segment. (Duplicate
18registrations are ignored, but not terribly quickly.)
19
20(There are two reasons for this. We didn't want to see many 16:16
21pointers. And the VirtualQuery call has different semantics under
22the two systems, and under different versions of win32s.)
23
24The collector test program "gctest" is linked as a GUI application,
25but does not open any windows. Its output appears in the file
26"gc.log". It may be started from the file manager. The hour glass
27cursor may appear as long as it's running. If it is started from the
28command line, it will usually run in the background. Wait a few
29minutes (a few seconds on a modern machine) before you check the output.
30You should see either a failure indication or a "Collector appears to
31work" message.
32
33The cord test program has not been ported (but should port
34easily). A toy editor (cord/de.exe) based on cords (heavyweight
35strings represented as trees) has been ported and is included.
36It runs fine under either win32 or win32S. It serves as an example
37of a true Windows application, except that it was written by a
38nonexpert Windows programmer. (There are some peculiarities
39in the way files are displayed. The <cr> is displayed explicitly
40for standard DOS text files. As in the UNIX version, control
41characters are displayed explicitly, but in this case as red text.
42This may be suboptimal for some tastes and/or sets of default
43window colors.)
44
45In general -DREDIRECT_MALLOC is unlikely to work unless the
46application is completely statically linked.
47
48The collector normally allocates memory from the OS with VirtualAlloc.
49This appears to cause problems under Windows NT and Windows 2000 (but
50not Windows 95/98) if the memory is later passed to CreateDIBitmap.
51To work around this problem, build the collector with -DUSE_GLOBAL_ALLOC.
52This is currently incompatible with -DUSE_MUNMAP. (Thanks to Jonathan
53Clark for tracking this down.)
54
55For Microsoft development tools, rename NT_MAKEFILE as
56MAKEFILE. (Make sure that the CPU environment variable is defined
57to be i386.) In order to use the gc_cpp.h C++ interface, all
58client code should include gc_cpp.h.
59
60Clients may need to define GC_NOT_DLL before including gc.h, if the
61collector was built as a static library (as it normally is in the
62absence of thread support).
63
64For GNU-win32, use the regular makefile, possibly after uncommenting
65the line "include Makefile.DLLs". The latter should be necessary only
66if you want to package the collector as a DLL. The GNU-win32 port is
67believed to work only for b18, not b19, probably dues to linker changes
68in b19. This is probably fixable with a different definition of
69DATASTART and DATAEND in gcconfig.h.
70
71For Borland tools, use BCC_MAKEFILE. Note that
72Borland's compiler defaults to 1 byte alignment in structures (-a1),
73whereas Visual C++ appears to default to 8 byte alignment (/Zp8).
74The garbage collector in its default configuration EXPECTS AT
75LEAST 4 BYTE ALIGNMENT. Thus the BORLAND DEFAULT MUST
76BE OVERRIDDEN. (In my opinion, it should usually be anyway.
77I expect that -a1 introduces major performance penalties on a
78486 or Pentium.) Note that this changes structure layouts. (As a last
79resort, gcconfig.h can be changed to allow 1 byte alignment. But
80this has significant negative performance implications.)
81The Makefile is set up to assume Borland 4.5. If you have another
82version, change the line near the top. By default, it does not
83require the assembler. If you do have the assembler, I recommend
84removing the -DUSE_GENERIC.
85
86There is some support for incremental collection. This is
87currently pretty simple-minded. Pages are protected. Protection
88faults are caught by a handler installed at the bottom of the handler
89stack. This is both slow and interacts poorly with a debugger.
90Whenever possible, I recommend adding a call to
91GC_enable_incremental at the last possible moment, after most
92debugging is complete. Unlike the UNIX versions, no system
93calls are wrapped by the collector itself. It may be necessary
94to wrap ReadFile calls that use a buffer in the heap, so that the
95call does not encounter a protection fault while it's running.
96(As usual, none of this is an issue unless GC_enable_incremental
97is called.)
98
99Note that incremental collection is disabled with -DSMALL_CONFIG.
100
101James Clark has contributed the necessary code to support win32 threads.
102Use NT_THREADS_MAKEFILE (a.k.a gc.mak) instead of NT_MAKEFILE
103to build this version. Note that this requires some files whose names
104are more than 8 + 3 characters long. Thus you should unpack the tar file
105so that long file names are preserved. To build the garbage collector
106test with VC++ from the command line, use
107
108nmake /F ".\gc.mak" CFG="gctest - Win32 Release"
109
110This requires that the subdirectory gctest\Release exist.
111The test program and DLL will reside in the Release directory.
112
113This version relies on the collector residing in a dll.
114
115This version currently supports incremental collection only if it is
116enabled before any additional threads are created.
117Version 4.13 attempts to fix some of the earlier problems, but there
118may be other issues. If you need solid support for win32 threads, you
119might check with Geodesic Systems. Their collector must be licensed,
120but they have invested far more time in win32-specific issues.
121
122Hans
123
124Ivan V. Demakov's README for the Watcom port:
125
126The collector has been compiled with Watcom C 10.6 and 11.0.
127It runs under win32, win32s, and even under msdos with dos4gw
128dos-extender. It should also run under OS/2, though this isn't
129tested. Under win32 the collector can be built either as dll
130or as static library.
131
132Note that all compilations were done under Windows 95 or NT.
133For unknown reason compiling under Windows 3.11 for NT (one
134attempt has been made) leads to broken executables.
135
136Incremental collection is not supported.
137
138cord is not ported.
139
140Before compiling you may need to edit WCC_MAKEFILE to set target
141platform, library type (dynamic or static), calling conventions, and
142optimization options.
143
144To compile the collector and testing programs use the command:
145 wmake -f WCC_MAKEFILE
146
147All programs using gc should be compiled with 4-byte alignment.
148For further explanations on this see comments about Borland.
149
150If gc compiled as dll, the macro ``GC_DLL'' should be defined before
151including "gc.h" (for example, with -DGC_DLL compiler option). It's
152important, otherwise resulting programs will not run.
153
154Ivan Demakov (email: ivan@tgrad.nsk.su)
155
156
Note: See TracBrowser for help on using the repository browser.