dpnet/tests: Add a trailing '\n' to some ok() calls.
[wine.git] / tools / winebuild / winebuild.man.in
blobdf91cb88377104c42fdc57af82d037b890b67c95
1 .TH WINEBUILD 1 "October 2005" "@PACKAGE_STRING@" "Wine Developers Manual"
2 .SH NAME
3 winebuild \- Wine dll builder
4 .SH SYNOPSIS
5 .B winebuild
6 .RI [ options ]\ [ inputfile ...]
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 \fB-E\fR 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 \fB--dll\fR 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 \fB-E\fR option. The executable is named from the .spec/.def file name if
40 present, or explicitly through the \fB-F\fR 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 \fB-E\fR 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 \fB-E\fR 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\fR[\fB-\fIkernel\fR]\fB-\fIos
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 \--cc-cmd= cc-command
71 Specify the C compiler to use to compile assembly files; the default
72 is to instead use the assembler specified with \fB--as-cmd\fR.
73 .TP
74 .BI \-d,\ --delay-lib= name
75 Set the delayed import mode for the specified library, which must be
76 one of the libraries imported with the \fB-l\fR option. Delayed mode
77 means that the library won't be loaded until a function imported from
78 it is actually called.
79 .TP
80 .BI \-D\  symbol
81 Ignored for compatibility with the C compiler.
82 .TP
83 .BI \-e,\ --entry= function
84 Specify the module entry point function; if not specified, the default
86 .B DllMain
87 for dlls, and
88 .B main
89 for executables (if the standard C
90 .B main
91 is not defined,
92 .B WinMain
93 is used instead). This is only valid for Win32 modules.
94 .TP
95 .BI \-E,\ --export= filename
96 Specify a .spec file (see \fBSPEC FILE SYNTAX\fR for details), 
97 or a standard Windows .def file that defines the exports
98 of the DLL or executable that is being built.
99 .TP
100 .B \--external-symbols
101 Allow linking to external symbols directly from the spec
102 file. Normally symbols exported by a dll have to be defined in the dll
103 itself; this option makes it possible to use symbols defined in
104 another Unix library (for symbols defined in another dll, a
105 .I forward
106 specification must be used instead).
108 .BI \-f\  option
109 Specify a code generation option. Currently \fB\-fPIC\fR and
110 \fB\-fasynchronous-unwind-tables\fR are supported. Other options are
111 ignored for compatibility with the C compiler.
113 .B \--fake-module
114 Create a fake PE module for a dll or exe, instead of the normal
115 assembly or object file. The PE module contains the resources for the
116 module, but no executable code.
118 .BI \-F,\ --filename= filename
119 Set the file name of the module. The default is to use the base name
120 of the spec file (without any extension).
122 .B \-h, --help
123 Display a usage message and exit.
125 .BI \-H,\ --heap= size
126 Specify the size of the module local heap in bytes (only valid for
127 Win16 modules); default is no local heap.
129 .BI \-I\  directory
130 Ignored for compatibility with the C compiler.
132 .B \-k, --kill-at
133 Remove the stdcall decorations from the symbol names in the
134 generated .def file. Only meaningful in \fB--def\fR mode.
136 .BI \-K\  flags
137 Ignored for compatibility with the C compiler.
139 .BI \--large-address-aware
140 Set a flag in the executable to notify the loader that this
141 application supports address spaces larger than 2 gigabytes.
143 .BI \--ld-cmd= ld-command
144 Specify the command to use to link the object files; the default is
145 \fBld\fR.
147 .BI \-L,\ --library-path= directory
148 Append the specified directory to the list of directories that are
149 searched for import libraries.
151 .BI \-l,\ --library= name
152 Import the specified library, looking for a corresponding
153 \fIlibname.def\fR file in the directories specified with the \fB-L\fR
154 option.
156 .B \-m16, -m32, -m64
157 Generate respectively 16-bit, 32-bit or 64-bit code.
159 .BI \-marm,\ \-mthumb,\ \-mcpu= option
160 Set code generation options for the assembler.
162 .BI \-M,\ --main-module= module
163 When building a 16-bit dll, set the name of its 32-bit counterpart to
164 \fImodule\fR. This is used to enforce that the load order for the
165 16-bit dll matches that of the 32-bit one.
167 .BI \-N,\ --dll-name= dllname
168 Set the internal name of the module. It is only used in Win16
169 modules. The default is to use the base name of the spec file (without
170 any extension). This is used for KERNEL, since it lives in
171 KRNL386.EXE. It shouldn't be needed otherwise.
173 .BI \--nm-cmd= nm-command
174 Specify the command to use to get the list of undefined symbols; the
175 default is \fBnm\fR.
177 .BI --nxcompat= yes\fR|\fIno
178 Specify whether the module is compatible with no-exec support. The
179 default is yes.
181 .BI \-o,\ --output= file
182 Set the name of the output file (default is standard output). If the
183 output file name ends in .o, the text output is sent to a
184 temporary file that is then assembled to produce the specified .o
185 file.
187 .BI \-r,\ --res= rsrc.res
188 Load resources from the specified binary resource file. The
189 \fIrsrc.res\fR file can be produced from a source resource file with
190 .BR wrc (1)
191 (or with a Windows resource compiler).
193 This option is only necessary for Win16 resource files, the Win32 ones
194 can simply listed as
195 .I input files
196 and will automatically be handled correctly (though the
197 .B \-r
198 option will also work for Win32 files).
200 .B --save-temps
201 Do not delete the various temporary files that \fBwinebuild\fR generates.
203 .BI --subsystem= subsystem\fR[\fB:\fImajor\fR[\fB.\fIminor\fR]]
204 Set the subsystem of the executable, which can be one of the following:
206 .B console
207 for a command line executable,
209 .B windows
210 for a graphical executable,
212 .B native
213 for a native-mode dll,
215 .B wince
216 for a ce dll.
218 The entry point of a command line executable is a normal C \fBmain\fR
219 function. A \fBwmain\fR function can be used instead if you need the
220 argument array to use Unicode strings. A graphical executable has a
221 \fBWinMain\fR entry point.
223 Optionally a major and minor subsystem version can also be specified;
224 the default subsystem version is 4.0.
226 .BI \-u,\ --undefined= symbol
227 Add \fIsymbol\fR to the list of undefined symbols when invoking the
228 linker. This makes it possible to force a specific module of a static
229 library to be included when resolving imports.
231 .B \-v, --verbose
232 Display the various subcommands being invoked by
233 .BR winebuild .
235 .B \--version
236 Display the program version and exit.
238 .B \-w, --warnings
239 Turn on warnings.
240 .SH "SPEC FILE SYNTAX"
241 .SS "General syntax"
242 A spec file should contain a list of ordinal declarations. The general
243 syntax is the following:
245 .I ordinal functype
246 .RI [ flags ]\  exportname \ \fB(\fR\ [ args... ] \ \fB) \ [ handler ]
248 .IB ordinal\  variable
249 .RI [ flags ]\  exportname \ \fB(\fR\ [ data... ] \ \fB)
251 .IB ordinal\  extern
252 .RI [ flags ]\  exportname \ [ symbolname ]
254 .IB ordinal\  stub
255 .RI [ flags ]\  exportname \ [\ \fB( args... \fB)\fR\ ]
257 .IB ordinal\  equate
258 .RI [ flags ]\  exportname\ data
260 .BI #\  comments
262 Declarations must fit on a single line, except if the end of line is
263 escaped using a backslash character. The
264 .B #
265 character anywhere in a line causes the rest of the line to be ignored
266 as a comment.
268 .I ordinal
269 specifies the ordinal number corresponding to the entry point, or '@'
270 for automatic ordinal allocation (Win32 only).
272 .I flags
273 is a series of optional flags, preceded by a '-' character. The
274 supported flags are:
277 .B -norelay
278 The entry point is not displayed in relay debugging traces (Win32
279 only).
281 .B -noname
282 The entry point will be exported by ordinal instead of by name. The
283 name is still available for importing.
285 .B -ret16
286 The function returns a 16-bit value (Win16 only).
288 .B -ret64
289 The function returns a 64-bit value (Win32 only).
291 .B -register
292 The function uses CPU register to pass arguments.
294 .B -private
295 The function cannot be imported from other dlls, it can only be
296 accessed through GetProcAddress.
298 .B -ordinal
299 The entry point will be imported by ordinal instead of by name. The
300 name is still exported.
302 .BI -arch= cpu\fR[\fB,\fIcpu\fR]
303 The entry point is only available on the specified CPU
304 architecture(s). The names \fBwin32\fR and \fBwin64\fR match all
305 32-bit or 64-bit CPU architectures respectively. In 16-bit dlls,
306 specifying \fB-arch=win32\fR causes the entry point to be exported
307 from the 32-bit wrapper module.
308 .SS "Function ordinals"
309 Syntax:
311 .I ordinal functype
312 .RI [ flags ]\  exportname \ \fB(\fR\ [ args... ] \ \fB) \ [ handler ]
315 This declaration defines a function entry point.  The prototype defined by
316 .IR exportname \ \fB(\fR\ [ args... ] \ \fB)
317 specifies the name available for dynamic linking and the format of the
318 arguments. '@' can be used instead of
319 .I exportname
320 for ordinal-only exports.
322 .I functype
323 should be one of:
326 .B stdcall
327 for a normal Win32 function
329 .B pascal
330 for a normal Win16 function
332 .B cdecl
333 for a Win16 or Win32 function using the C calling convention
335 .B varargs
336 for a Win16 or Win32 function using the C calling convention with a
337 variable number of arguments
339 .B thiscall
340 for a Win32 function using the
341 .I thiscall
342 calling convention (first parameter in %ecx register on i386)
345 .I args
346 should be one or several of:
349 .B word
350 (16-bit unsigned value)
352 .B s_word
353 (16-bit signed word)
355 .B long
356 (pointer-sized integer value)
358 .B int64
359 (64-bit integer value)
361 .B int128
362 (128-bit integer value)
364 .B float
365 (32-bit floating point value)
367 .B double
368 (64-bit floating point value)
370 .B ptr
371 (linear pointer)
373 .B str
374 (linear pointer to a null-terminated ASCII string)
376 .B wstr
377 (linear pointer to a null-terminated Unicode string)
379 .B segptr
380 (segmented pointer)
382 .B segstr
383 (segmented pointer to a null-terminated ASCII string).
385 Note: The 16-bit and segmented pointer types are only valid for Win16
386 functions.
389 .I handler
390 is the name of the actual C function that will implement that entry
391 point in 32-bit mode. The handler can also be specified as
392 .IB dllname . function
393 to define a forwarded function (one whose implementation is in another
394 dll). If
395 .I handler
396 is not specified, it is assumed to be identical to
397 .I exportname.
399 This first example defines an entry point for the 32-bit GetFocus()
400 call:
402 @ stdcall GetFocus() GetFocus
404 This second example defines an entry point for the 16-bit
405 CreateWindow() call (the ordinal 100 is just an example); it also
406 shows how long lines can be split using a backslash:
408 100 pascal CreateWindow(ptr ptr long s_word s_word s_word \\
409     s_word word word word ptr) WIN_CreateWindow
411 To declare a function using a variable number of arguments, specify
412 the function as
413 .B varargs
414 and declare it in the C file with a '...' parameter for a Win32
415 function, or with an extra VA_LIST16 argument for a Win16 function.
416 See the wsprintf* functions in user.exe.spec and user32.spec for an
417 example.
418 .SS "Variable ordinals"
419 Syntax:
421 .IB ordinal\  variable
422 .RI [ flags ]\  exportname \ \fB(\fR\ [ data... ] \ \fB)
424 This declaration defines data storage as 32-bit words at the ordinal
425 specified.
426 .I exportname
427 will be the name available for dynamic
428 linking.
429 .I data
430 can be a decimal number or a hex number preceded by "0x".  The
431 following example defines the variable VariableA at ordinal 2 and
432 containing 4 ints:
434 2 variable VariableA(-1 0xff 0 0)
436 This declaration only works in Win16 spec files. In Win32 you should
438 .B extern
439 instead (see below).
440 .SS "Extern ordinals"
441 Syntax:
443 .IB ordinal\  extern
444 .RI [ flags ]\  exportname \ [ symbolname ]
446 This declaration defines an entry that simply maps to a C symbol
447 (variable or function). It only works in Win32 spec files.
448 .I exportname
449 will point to the symbol
450 .I symbolname
451 that must be defined in the C code. Alternatively, it can be of the
452 form
453 .IB dllname . symbolname
454 to define a forwarded symbol (one whose implementation is in another
455 dll). If
456 .I symbolname
457 is not specified, it is assumed to be identical to
458 .I exportname.
459 .SS "Stub ordinals"
460 Syntax:
462 .IB ordinal\  stub
463 .RI [ flags ]\  exportname \ [\ \fB( args... \fB)\fR\ ]
465 This declaration defines a stub function. It makes the name and
466 ordinal available for dynamic linking, but will terminate execution
467 with an error message if the function is ever called.
468 .SS "Equate ordinals"
469 Syntax:
471 .IB ordinal\  equate
472 .RI [ flags ]\  exportname\ data
474 This declaration defines an ordinal as an absolute value.
475 .I exportname
476 will be the name available for dynamic linking.
477 .I data
478 can be a decimal number or a hex number preceded by "0x".
479 .SH AUTHORS
480 .B winebuild
481 has been worked on by many people over the years. The main authors are
482 Robert J. Amstadt, Alexandre Julliard, Martin von Loewis, Ulrich
483 Weigand and Eric Youngdale. Many other people have contributed new features
484 and bug fixes. For a complete list, see the git commit logs.
485 .SH BUGS
486 It is not yet possible to use a PE-format dll in an import
487 specification; only Wine dlls can be imported.
489 Bugs can be reported on the
490 .UR http://bugs.winehq.org
491 .B Wine bug tracker
492 .UE .
493 .SH AVAILABILITY
494 .B winebuild
495 is part of the Wine distribution, which is available through WineHQ,
497 .UR http://www.winehq.org/
498 .B Wine development headquarters
499 .UE .
500 .SH "SEE ALSO"
501 .BR wine (1),
502 .BR winegcc (1),
503 .BR wrc (1),
505 .UR http://www.winehq.org/help
506 .B Wine documentation and support
507 .UE .