d3dxof: Do not expect a separator when there is no element.
[wine/multimedia.git] / tools / winebuild / winebuild.man.in
blob88452d3bd06cf67a0f1dbe64b12fac86638ac04c
1 .\" -*- nroff -*-
2 .TH WINEBUILD 1 "October 2005" "@PACKAGE_STRING@" "Wine Developers Manual"
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 assembly files that are necessary to build a Wine dll,
10 which is basically a Win32 dll encapsulated inside a Unix library.
11 .PP
12 .B winebuild
13 has different modes, depending on what kind of file it is asked to
14 generate. The mode is specified by one of the mode options specified
15 below. In addition to the mode option, various other command-line
16 option can be specified, as described in the \fBOPTIONS\fR section.
17 .SH "MODE OPTIONS"
18 You have to specify exactly one of the following options, depending on
19 what you want winebuild to generate.
20 .TP
21 .BI \--dll
22 Build an assembly file from a .spec file (see \fBSPEC FILE SYNTAX\fR
23 for details), or from a standard Windows .def file. The .spec/.def
24 file is specified via the -E option. The resulting file must be
25 assembled and linked to the other object files to build a working Wine
26 dll.  In this mode, the
27 .I input files
28 should be the list of all object files that will be linked into the
29 final dll, to allow
30 .B winebuild
31 to get the list of all undefined symbols that need to be imported from
32 other dlls.
33 .TP
34 .BI \--exe
35 Build an assembly file for an executable. This is basically the same as
36 the --dll mode except that it doesn't require a .spec/.def file as input,
37 since an executable need not export functions. Some executables however
38 do export functions, and for those a .spec/.def file can be specified via
39 the -E option. The executable is named from the .spec/.def file name if 
40 present, or explicitly through the -F option. The resulting file must be 
41 assembled and linked to the other object files to build a working Wine 
42 executable, and all the other object files must be listed as
43 .I input files.
44 .TP
45 .BI \--def
46 Build a .def file from a spec file. The .spec file is specified via the
47 -E option. This is used when building dlls with a PE (Win32) compiler.
48 .TP
49 .BI \--implib
50 Build a PE import library from a spec file. The .spec file is
51 specified via the -E option.
52 .TP
53 .B \--resources
54 Generate a .o file containing all the input resources. This is useful
55 when building with a PE compiler, since the PE binutils cannot handle
56 multiple resource files as input. For a standard Unix build, the
57 resource files are automatically included when building the spec file,
58 so there's no need for an intermediate .o file.
59 .SH OPTIONS
60 .TP
61 .BI \--as-cmd= as-command
62 Specify the command to use to compile assembly files; the default is
63 \fBas\fR.
64 .TP
65 .BI \-b,\ --target= cpu-manufacturer[-kernel]-os
66 Specify the target CPU and platform on which the generated code will
67 be built. The target specification is in the standard autoconf format
68 as returned by config.sub.
69 .TP
70 .BI \-d,\ --delay-lib= name
71 Set the delayed import mode for the specified library, which must be
72 one of the libraries imported with the \fB-l\fR option. Delayed mode
73 means that the library won't be loaded until a function imported from
74 it is actually called.
75 .TP
76 .BI \-D\  symbol
77 Ignored for compatibility with the C compiler.
78 .TP
79 .BI \-e,\ --entry= function
80 Specify the module entry point function; if not specified, the default
82 .B DllMain
83 for dlls, and
84 .B main
85 for executables (if the standard C
86 .B main
87 is not defined,
88 .B WinMain
89 is used instead). This is only valid for Win32 modules.
90 .TP
91 .BI \-E,\ --export= filename
92 Specify a .spec file (see \fBSPEC FILE SYNTAX\fR for details), 
93 or a standard Windows .def file that defines the exports
94 of the DLL or executable that is being built.
95 .TP
96 .B \--external-symbols
97 Allow linking to external symbols directly from the spec
98 file. Normally symbols exported by a dll have to be defined in the dll
99 itself; this option makes it possible to use symbols defined in
100 another Unix library (for symbols defined in another dll, a
101 .I forward
102 specification must be used instead).
104 .BI \-f\  flags
105 Ignored for compatibility with the C compiler.
107 .B \--fake-module
108 Create a fake PE module for a dll or exe, instead of the normal
109 assembly or object file. The PE module contains the resources for the
110 module, but no executable code.
112 .BI \-F,\ --filename= filename
113 Set the file name of the module. The default is to use the base name
114 of the spec file (without any extension).
116 .B \-h, --help
117 Display a usage message and exit.
119 .BI \-H,\ --heap= size
120 Specify the size of the module local heap in bytes (only valid for
121 Win16 modules); default is no local heap.
123 .BI \-i,\ --ignore= [-]symbol[,[-]symbol]
124 Specify a list of symbols that should be ignored when resolving
125 undefined symbols against the imported libraries. This forces these
126 symbols to be resolved from the Unix C library (or from another Unix
127 library linked with the application). If a symbol is prefixed by '-'
128 it is removed from the list instead of being added; a stand-alone '-'
129 clears the whole list.
131 .BI \-I\  directory
132 Ignored for compatibility with the C compiler.
134 .B \-k, --kill-at
135 Remove the stdcall decorations from the symbol names in the
136 generated .def file. Only meaningful in \fB--def\fR mode.
138 .BI \-K\  flags
139 Ignored for compatibility with the C compiler.
141 .BI \--large-address-aware
142 Set a flag in the executable to notify the loader that this
143 application supports address spaces larger than 2 gigabytes.
145 .BI \--ld-cmd= ld-command
146 Specify the command to use to link the object files; the default is
147 \fBld\fR.
149 .BI \-L,\ --library-path= directory
150 Append the specified directory to the list of directories that are
151 searched for import libraries.
153 .BI \-l,\ --library= name
154 Import the specified library, looking for a corresponding
155 \fIlibname.def\fR file in the directories specified with the \fB-L\fR
156 option.
158 .B \-m32, -m64
159 Generate 32-bit, respectively 64-bit code.
161 .BI \-M,\ --main-module= module
162 When building a 16-bit dll, set the name of its 32-bit counterpart to
163 \fImodule\fR. This is used to enforce that the load order for the
164 16-bit dll matches that of the 32-bit one.
166 .BI \-N,\ --dll-name= dllname
167 Set the internal name of the module. It is only used in Win16
168 modules. The default is to use the base name of the spec file (without
169 any extension). This is used for KERNEL, since it lives in
170 KRNL386.EXE. It shouldn't be needed otherwise.
172 .BI \--nm-cmd= nm-command
173 Specify the command to use to get the list of undefined symbols; the
174 default is \fBnm\fR.
176 .BI --nxcompat= yes|no
177 Specify whether the module is compatible with no-exec support. The
178 default is yes.
180 .BI \-o,\ --output= file
181 Set the name of the output file (default is standard output). If the
182 output file name end in \fB.o\fR, the text output is sent to a
183 temporary file that is then assembled to produce the specified .o
184 file.
186 .BI \-r,\ --res= rsrc.res
187 Load resources from the specified binary resource file. The
188 \fIrsrc.res\fR file can be produced from a source resource file with
189 .BR wrc(1)
190 (or with a Windows resource compiler).
192 This option is only necessary for Win16 resource files, the Win32 ones
193 can simply listed as
194 .I input files
195 and will automatically be handled correctly (though the
196 .B \-r
197 option will also work for Win32 files).
199 .B --save-temps
200 Do not delete the various temporary files that \fBwinebuild\fR generates.
202 .BI --subsystem= subsystem[:major[.minor]]
203 Set the subsystem of the executable, which can be one of the following:
205 .B console
206 for a command line executable,
208 .B windows
209 for a graphical executable,
211 .B native
212 for a native-mode dll,
214 .B win16
215 for a 16-bit module.
217 The entry point of a command line executable is a normal C \fBmain\fR
218 function. A \fBwmain\fR function can be used instead if you need the
219 argument array to use Unicode strings. A graphical executable has a
220 \fBWinMain\fR entry point.
222 Optionally a major and minor subsystem version can also be specified;
223 the default subsystem version is 4.0.
225 .BI \-u,\ --undefined= symbol
226 Add \fIsymbol\fR to the list of undefined symbols when invoking the
227 linker. This makes it possible to force a specific module of a static
228 library to be included when resolving imports.
230 .B \-v, --verbose
231 Display the various subcommands being invoked by
232 .B winebuild.
234 .B \--version
235 Display the program version and exit.
237 .B \-w, --warnings
238 Turn on warnings.
239 .SH "SPEC FILE SYNTAX"
240 .SS "General syntax"
241 A spec file should contain a list of ordinal declarations. The general
242 syntax is the following:
244 .I ordinal functype
245 .RI [ flags ]\  exportname \ \fB(\fR\ [ args... ] \ \fB) \ [ handler ]
247 .IB ordinal\  variable
248 .RI [ flags ]\  exportname \ \fB(\fR\ [ data... ] \ \fB)
250 .IB ordinal\  extern
251 .RI [ flags ]\  exportname \ [ symbolname ]
253 .IB ordinal\  stub
254 .RI [ flags ]\  exportname
256 .IB ordinal\  equate
257 .RI [ flags ]\  exportname\ data
259 .BI #\  comments
261 Declarations must fit on a single line, except if the end of line is
262 escaped using a backslash character. The
263 .B #
264 character anywhere in a line causes the rest of the line to be ignored
265 as a comment.
267 .I ordinal
268 specifies the ordinal number corresponding to the entry point, or '@'
269 for automatic ordinal allocation (Win32 only).
271 .I flags
272 is a series of optional flags, preceded by a '-' character. The
273 supported flags are:
276 .B -norelay
277 The entry point is not displayed in relay debugging traces (Win32
278 only).
280 .B -noname
281 The entry point will be exported by ordinal instead of by name. The
282 name is still available for importing.
284 .B -ret16
285 The function returns a 16-bit value (Win16 only).
287 .B -ret64
288 The function returns a 64-bit value (Win32 only).
290 .B -register
291 The function uses CPU register to pass arguments.
293 .B -private
294 The function cannot be imported from other dlls, it can only be
295 accessed through GetProcAddress.
297 .B -ordinal
298 The entry point will be imported by ordinal instead of by name. The
299 name is still exported.
301 .BI -arch= cpu[,cpu]
302 The entry point is only available on the specified CPU
303 architecture(s). The names \fBwin32\fR and \fBwin64\fR match all
304 32-bit, respectively 64-bit, CPU architectures. In 16-bit dlls,
305 specifying \fB-arch=win32\fR causes the entry point to be exported
306 from the 32-bit wrapper module.
307 .SS "Function ordinals"
308 Syntax:
310 .I ordinal functype
311 .RI [ flags ]\  exportname \ \fB(\fR\ [ args... ] \ \fB) \ [ handler ]
314 This declaration defines a function entry point.  The prototype defined by
315 .IR exportname \ \fB(\fR\ [ args... ] \ \fB)
316 specifies the name available for dynamic linking and the format of the
317 arguments. '@' can be used instead of
318 .I exportname
319 for ordinal-only exports.
321 .I functype
322 should be one of:
325 .B stdcall
326 for a normal Win32 function
328 .B pascal
329 for a normal Win16 function
331 .B cdecl
332 for a Win16 or Win32 function using the C calling convention
334 .B varargs
335 for a Win16 or Win32 function using the C calling convention with a
336 variable number of arguments
339 .I args
340 should be one or several of:
343 .B word
344 (16-bit unsigned value)
346 .B s_word
347 (16-bit signed word)
349 .B long
350 (32-bit value)
352 .B double
353 (64-bit value)
355 .B ptr
356 (linear pointer)
358 .B str
359 (linear pointer to a null-terminated ASCII string)
361 .B wstr
362 (linear pointer to a null-terminated Unicode string)
364 .B segptr
365 (segmented pointer)
367 .B segstr
368 (segmented pointer to a null-terminated ASCII string).
370 .RB Only\  ptr ,\  str ,\  wstr ,\  long\  and\  double
371 are valid for Win32 functions.
374 .I handler
375 is the name of the actual C function that will implement that entry
376 point in 32-bit mode. The handler can also be specified as
377 .IB dllname . function
378 to define a forwarded function (one whose implementation is in another
379 dll). If
380 .I handler
381 is not specified, it is assumed to be identical to
382 .I exportname.
384 This first example defines an entry point for the 32-bit GetFocus()
385 call:
387 @ stdcall GetFocus() GetFocus
389 This second example defines an entry point for the 16-bit
390 CreateWindow() call (the ordinal 100 is just an example); it also
391 shows how long lines can be split using a backslash:
393 100 pascal CreateWindow(ptr ptr long s_word s_word s_word \\
394     s_word word word word ptr) WIN_CreateWindow
396 To declare a function using a variable number of arguments, specify
397 the function as
398 .B varargs
399 and declare it in the C file with a '...' parameter for a Win32
400 function, or with an extra VA_LIST16 argument for a Win16 function.
401 See the wsprintf* functions in user.exe.spec and user32.spec for an
402 example.
403 .SS "Variable ordinals"
404 Syntax:
406 .IB ordinal\  variable
407 .RI [ flags ]\  exportname \ \fB(\fR\ [ data... ] \ \fB)
409 This declaration defines data storage as 32-bit words at the ordinal
410 specified.
411 .I exportname
412 will be the name available for dynamic
413 linking.
414 .I data
415 can be a decimal number or a hex number preceded by "0x".  The
416 following example defines the variable VariableA at ordinal 2 and
417 containing 4 ints:
419 2 variable VariableA(-1 0xff 0 0)
421 This declaration only works in Win16 spec files. In Win32 you should
423 .B extern
424 instead (see below).
425 .SS "Extern ordinals"
426 Syntax:
428 .IB ordinal\  extern
429 .RI [ flags ]\  exportname \ [ symbolname ]
431 This declaration defines an entry that simply maps to a C symbol
432 (variable or function). It only works in Win32 spec files.
433 .I exportname
434 will point to the symbol
435 .I symbolname
436 that must be defined in the C code. Alternatively, it can be of the
437 form
438 .IB dllname . symbolname
439 to define a forwarded symbol (one whose implementation is in another
440 dll). If
441 .I symbolname
442 is not specified, it is assumed to be identical to
443 .I exportname.
444 .SS "Stub ordinals"
445 Syntax:
447 .IB ordinal\  stub
448 .RI [ flags ]\  exportname
450 This declaration defines a stub function. It makes the name and
451 ordinal available for dynamic linking, but will terminate execution
452 with an error message if the function is ever called.
453 .SS "Equate ordinals"
454 Syntax:
456 .IB ordinal\  equate
457 .RI [ flags ]\  exportname\ data
459 This declaration defines an ordinal as an absolute value.
460 .I exportname
461 will be the name available for dynamic linking.
462 .I data
463 can be a decimal number or a hex number preceded by "0x".
464 .SH AUTHORS
465 .B winebuild
466 has been worked on by many people over the years. The main authors are
467 Robert J. Amstadt, Alexandre Julliard, Martin von Loewis, Ulrich
468 Weigand and Eric Youngdale. Many other Wine developers have
469 contributed, please check the file Changelog in the Wine distribution
470 for the complete details.
471 .SH BUGS
472 It is not yet possible to use a PE-format dll in an import
473 specification; only Wine dlls can be imported.
475 If you find a bug, please submit a bug report at
476 .UR http://bugs.winehq.org
477 .B http://bugs.winehq.org.
479 .SH AVAILABILITY
480 .B winebuild
481 is part of the wine distribution, which is available through WineHQ,
483 .B wine
484 development headquarters, at
485 .UR http://www.winehq.org/
486 .B http://www.winehq.org/.
488 .SH "SEE ALSO"
489 .BR wine (1),
490 .BR winegcc (1),
491 .BR wrc (1).