Store the winsock per-thread data in NtCurrentTeb()->WinSockData
[wine/testsucceed.git] / tools / winebuild / winebuild.man.in
blob19fddf5a6480d55254e143e7a26624b9af9caf4e
1 .\" -*- nroff -*-
2 .TH WINEBUILD 1 "March 2003" "@PACKAGE_STRING@" "Wine dll builder"
3 .SH NAME
4 winebuild \- Wine dll builder
5 .SH SYNOPSIS
6 .BI winebuild\  [options]\ [input\ files]
7 .SH DESCRIPTION
8 .B winebuild
9 generates the C and assembly files that are necessary to build a Wine
10 dll, which is basically a Win32 dll encapsulated inside a Unix
11 library.
12 .PP
13 .B winebuild
14 has different modes, depending on what kind of file it is asked to
15 generate. The mode is specified by one of the mode options specified
16 below. In addition to the mode option, various other command-line
17 option can be specified, as described in the \fBOPTIONS\fR section.
18 .SH "MODE OPTIONS"
19 You have to specify exactly one of the following options, depending on
20 what you want winebuild to generate.
21 .TP
22 .BI \--dll
23 Build a C file from a .spec file (see \fBSPEC FILE SYNTAX\fR for
24 details), or from a standard Windows .def file. The .spec/.def file
25 is specified via the -E option. The resulting C file must be compiled 
26 and linked to the other object files to build a working Wine dll.
27 In this mode, the
28 .I input files
29 should be the list of all object files that will be linked into the
30 final dll, to allow
31 .B winebuild
32 to get the list of all undefined symbols that need to be imported from
33 other dlls.
34 .TP
35 .BI \--exe
36 Build a C file for an executable. This is basically the same as
37 the --dll mode except that it doesn't require a .spec/.def file as input,
38 since an executable need not export functions. Some executables however
39 do export functions, and for those a .spec/.def file can be specified via
40 the -E option. The executable is named from the .spec/.def file name if 
41 present, or explicitly through the -F option. The resulting C file must be 
42 compiled and linked to the other object files to build a working Wine 
43 executable, and all the other object files must be listed as
44 .I input files.
45 .TP
46 .BI \--def
47 Build a .def file from a spec file. The .spec file is specified via the
48 -E option. This is used when building dlls with a PE (Win32) compiler.
49 .TP
50 .B \--debug
51 Build a C file containing the definitions for debugging channels. In
52 that mode the
53 .I input files
54 should be a list of C files to search for debug channel
55 definitions. The resulting C file must be compiled and linked with the
56 dll.
57 .TP
58 .B \--relay16
59 Generate the assembly code for the 16-bit relay routines. This is for
60 Wine internal usage only, you should never need to use this option.
61 .TP
62 .B \--relay32
63 Generate the assembly code for the 32-bit relay routines. This is for
64 Wine internal usage only, you should never need to use this option.
65 .SH OPTIONS
66 .TP
67 .BI \-C,\ --source-dir= directory
68 Change to the specified directory before reading source files. Only
69 meaningful in
70 .BR \--debug\  mode.
71 .TP
72 .BI \-d,\ --delay-lib= name
73 Set the delayed import mode for the specified library, which must be
74 one of the libraries imported with the \fB-l\fR option. Delayed mode
75 means that the library won't be loaded until a function imported from
76 it is actually called.
77 .TP
78 .BI \-D\  symbol
79 Ignored for compatibility with the C compiler.
80 .TP
81 .BI \-e,\ --entry= function
82 Specify the module entry point function; if not specified, the default
84 .B DllMain
85 for dlls, and
86 .B WinMain
87 for executables (if
88 .B WinMain
89 is not defined, the standard C
90 .B main
91 is used instead). This is only valid for Win32 modules.
92 .TP
93 .BI \-E,\ --export= filename
94 Specify a .spec file (see \fBSPEC FILE SYNTAX\fR for details), 
95 or a standard Windows .def file that defines the exports
96 of the DLL or executable that is being built.
97 .TP
98 .BI \-f\  flags
99 Ignored for compatibility with the C compiler.
101 .BI \-F,\ --filename= filename
102 Set the file name of the module. The default is to use the base name
103 of the spec file (without any extension).
105 .B \-h, --help
106 Display a usage message and exit.
108 .BI \-H,\ --heap= size
109 Specify the size of the module local heap in bytes (only valid for
110 Win16 modules); default is no local heap.
112 .BI \-i,\ --ignore= [-]symbol[,[-]symbol]
113 Specify a list of symbols that should be ignored when resolving
114 undefined symbols against the imported libraries. This forces these
115 symbols to be resolved from the Unix C library (or from another Unix
116 library linked with the application). If a symbol is prefixed by '-'
117 it is removed from the list instead of being added; a stand-alone '-'
118 clears the whole list.
120 .BI \-I\  directory
121 Ignored for compatibility with the C compiler.
123 .B \-k, --kill-at
124 Remove the stdcall decorations from the symbol names in the
125 generated .def file. Only meaningful in \fB--def\fR mode.
127 .BI \-K\  flags
128 Ignored for compatibility with the C compiler.
130 .BI \--ld-cmd= ld-command
131 Specify the command to use to link the object files; the default is
132 \fBld\fR.
134 .BI \--nm-cmd= nm-command
135 Specify the command to use to get the list of undefined symbols; the
136 default is \fBnm\fR.
138 .BI \-L,\ --library-path= directory
139 Append the specified directory to the list of directories that are
140 searched for import libraries.
142 .BI \-l,\ --library= name
143 Import the specified library, looking for a corresponding
144 \fIlibname.def\fR file in the directories specified with the \fB-L\fR
145 option.
147 .BI \-M,\ --main-module= module
148 Specify that we are building a 16-bit dll, that will ultimately be
149 linked together with the 32-bit dll specified in \fImodule\fR.  Only
150 meaningful in \fB--dll\fR mode.
152 .BI \-N,\ --dll-name= dllname
153 Set the internal name of the module. It is only used in Win16
154 modules. The default is to use the base name of the spec file (without
155 any extension). This is used for KERNEL, since it lives in
156 KRNL386.EXE. It shouldn't be needed otherwise.
158 .BI \-o,\ --output= file
159 Set the name of the output file (default is standard output).
161 .BI \-r,\ --res= rsrc.res
162 Load resources from the specified binary resource file. The
163 \fIrsrc.res\fR can be produced from a source resource file with
164 .BR wrc(1)
165 (or with a Windows resource compiler).
167 This option is only necessary for Win16 resource files, the Win32 ones
168 can simply listed as
169 .I input files
170 and will automatically be handled correctly (though the
171 .B \-r
172 option will also work for Win32 files).
174 .BI --subsystem= subsystem[:major[.minor]]
175 Set the subsystem of the executable, which can be one of the following:
177 .B console
178 for a command line executable,
180 .B windows
181 for a graphical executable,
183 .B native
184 for a native-mode dll.
186 The entry point of a command line executable is a normal C \fBmain\fR
187 function. A \fBwmain\fR function can be used instead if you need the
188 argument array to use Unicode strings. A graphical executable has a
189 \fBWinMain\fR entry point.
191 Optionally a major and minor subsystem version can also be specified;
192 the default subsystem version is 4.0.
194 .B \--version
195 Display the program version and exit.
197 .B \-w, --warnings
198 Turn on warnings.
199 .SH "SPEC FILE SYNTAX"
200 .SS "General syntax"
201 A spec file should contain a list of ordinal declarations. The general
202 syntax is the following:
204 .I ordinal functype
205 .RI [ flags ]\  exportname \ \fB(\fR\ [ args... ] \ \fB) \ [ handler ]
207 .IB ordinal\  variable
208 .RI [ flags ]\  exportname \ \fB(\fR\ [ data... ] \ \fB)
210 .IB ordinal\  extern
211 .RI [ flags ]\  exportname \ [ symbolname ]
213 .IB ordinal\  stub
214 .RI [ flags ]\  exportname
216 .IB ordinal\  equate
217 .RI [ flags ]\  exportname\ data
219 .BI #\  comments
221 Declarations must fit on a single line, except if the end of line is
222 escaped using a backslash character. The
223 .B #
224 character anywhere in a line causes the rest of the line to be ignored
225 as a comment.
227 .I ordinal
228 specifies the ordinal number corresponding to the entry point, or '@'
229 for automatic ordinal allocation (Win32 only).
231 .I flags
232 is a series of optional flags, preceded by a '-' character. The
233 supported flags are:
236 .B -norelay
237 The entry point is not displayed in relay debugging traces (Win32
238 only).
240 .B -noname
241 The entry point will be imported by ordinal instead of by name.
243 .B -ret16
244 The function returns a 16-bit value (Win16 only).
246 .B -ret64
247 The function returns a 64-bit value (Win32 only).
249 .B -i386
250 The entry point is only available on i386 platforms.
252 .B -register
253 The function uses CPU register to pass arguments (Win16 only).
255 .B -private
256 The function cannot be imported from other dlls, it can only be
257 accessed through GetProcAddress.
258 .SS "Function ordinals"
259 Syntax:
261 .I ordinal functype
262 .RI [ flags ]\  exportname \ \fB(\fR\ [ args... ] \ \fB) \ [ handler ]
265 This declaration defines a function entry point.  The prototype defined by
266 .IR exportname \ \fB(\fR\ [ args... ] \ \fB)
267 specifies the name available for dynamic linking and the format of the
268 arguments. '@' can be used instead of
269 .I exportname
270 for ordinal-only exports.
272 .I functype
273 should be one of:
276 .B stdcall
277 for a normal Win32 function
279 .B pascal
280 for a normal Win16 function
282 .B cdecl
283 for a Win16 or Win32 function using the C calling convention
285 .B varargs
286 for a Win16 or Win32 function using the C calling convention with a
287 variable number of arguments
290 .I args
291 should be one or several of:
294 .B word
295 (16-bit unsigned value)
297 .B s_word
298 (16-bit signed word)
300 .B long
301 (32-bit value)
303 .B double
304 (64-bit value)
306 .B ptr
307 (linear pointer)
309 .B str
310 (linear pointer to a null-terminated ASCII string)
312 .B wstr
313 (linear pointer to a null-terminated Unicode string)
315 .B segptr
316 (segmented pointer)
318 .B segstr
319 (segmented pointer to a null-terminated ASCII string).
321 .RB Only\  ptr ,\  str ,\  wstr ,\  long\  and\  double
322 are valid for Win32 functions.
325 .I handler
326 is the name of the actual C function that will implement that entry
327 point in 32-bit mode. The handler can also be specified as
328 .IB dllname . function
329 to define a forwarded function (one whose implementation is in another
330 dll). If
331 .I handler
332 is not specified, it is assumed to be identical to
333 .I exportname.
335 This first example defines an entry point for the 32-bit GetFocus()
336 call:
338 @ stdcall GetFocus() GetFocus
340 This second example defines an entry point for the 16-bit
341 CreateWindow() call (the ordinal 100 is just an example); it also
342 shows how long lines can be split using a backslash:
344 100 pascal CreateWindow(ptr ptr long s_word s_word s_word \\
345     s_word word word word ptr) WIN_CreateWindow
347 To declare a function using a variable number of arguments, specify
348 the function as
349 .B varargs
350 and declare it in the C file with a '...' parameter for a Win32
351 function, or with an extra VA_LIST16 argument for a Win16 function.
352 See the wsprintf* functions in user.exe.spec and user32.spec for an
353 example.
354 .SS "Variable ordinals"
355 Syntax:
357 .IB ordinal\  variable
358 .RI [ flags ]\  exportname \ \fB(\fR\ [ data... ] \ \fB)
360 This declaration defines data storage as 32-bit words at the ordinal
361 specified.
362 .I exportname
363 will be the name available for dynamic
364 linking.
365 .I data
366 can be a decimal number or a hex number preceded by "0x".  The
367 following example defines the variable VariableA at ordinal 2 and
368 containing 4 ints:
370 2 variable VariableA(-1 0xff 0 0)
372 This declaration only works in Win16 spec files. In Win32 you should
374 .B extern
375 instead (see below).
376 .SS "Extern ordinals"
377 Syntax:
379 .IB ordinal\  extern
380 .RI [ flags ]\  exportname \ [ symbolname ]
382 This declaration defines an entry that simply maps to a C symbol
383 (variable or function). It only works in Win32 spec files.
384 .I exportname
385 will point to the symbol
386 .I symbolname
387 that must be defined in the C code. Alternatively, it can be of the
388 form
389 .IB dllname . symbolname
390 to define a forwarded symbol (one whose implementation is in another
391 dll). If
392 .I symbolname
393 is not specified, it is assumed to be identical to
394 .I exportname.
395 .SS "Stub ordinals"
396 Syntax:
398 .IB ordinal\  stub
399 .RI [ flags ]\  exportname
401 This declaration defines a stub function. It makes the name and
402 ordinal available for dynamic linking, but will terminate execution
403 with an error message if the function is ever called.
404 .SS "Equate ordinals"
405 Syntax:
407 .IB ordinal\  equate
408 .RI [ flags ]\  exportname\ data
410 This declaration defines an ordinal as an absolute value.
411 .I exportname
412 will be the name available for dynamic linking.
413 .I data
414 can be a decimal number or a hex number preceded by "0x".
415 .SH AUTHORS
416 .B winebuild
417 has been worked on by many people over the years. The main authors are
418 Robert J. Amstadt, Alexandre Julliard, Martin von Loewis, Ulrich
419 Weigand and Eric Youngdale. Many other Wine developers have
420 contributed, please check the file Changelog in the Wine distribution
421 for the complete details.
422 .SH BUGS
423 It is not yet possible to use a PE-format dll in an import
424 specification; only Wine dlls can be imported.
426 If you find a bug, please submit a bug report at
427 .UR http://bugs.winehq.org
428 .B http://bugs.winehq.org.
430 .SH AVAILABILITY
431 .B winebuild
432 is part of the wine distribution, which is available through WineHQ,
434 .B wine
435 development headquarters, at
436 .UR http://www.winehq.org/
437 .B http://www.winehq.org/.
439 .SH "SEE ALSO"
440 .BR wine (1),
441 .BR winegcc (1),
442 .BR wrc (1).