iphlpapi: Consolidate append_*_row functions.
[wine.git] / tools / winebuild / winebuild.man.in
blob4da48ffa81338638c71f75d38945c96610919d66
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 .a import library from a spec file. The .spec file is
51 specified via the \fB-E\fR option. If the output library name ends
52 in .delay.a, a delayed import library is built.
53 .TP
54 .BI \--builtin
55 Mark a PE module as a Wine builtin module, by adding the "Wine builtin
56 DLL" signature string after the DOS header.
57 .TP
58 .B \--resources
59 Generate a .o file containing all the input resources. This is useful
60 when building with a PE compiler, since the PE binutils cannot handle
61 multiple resource files as input. For a standard Unix build, the
62 resource files are automatically included when building the spec file,
63 so there's no need for an intermediate .o file.
64 .SH OPTIONS
65 .TP
66 .BI \--as-cmd= as-command
67 Specify the command to use to compile assembly files; the default is
68 \fBas\fR.
69 .TP
70 .BI \-b,\ --target= cpu-manufacturer\fR[\fB-\fIkernel\fR]\fB-\fIos
71 Specify the target CPU and platform on which the generated code will
72 be built. The target specification is in the standard autoconf format
73 as returned by config.sub.
74 .TP
75 .BI \-B\  directory
76 Add the directory to the search path for the various binutils tools
77 like \fBas\fR, \fBnm\fR and \fBld\fR.
78 .TP
79 .BI \--cc-cmd= cc-command
80 Specify the C compiler to use to compile assembly files; the default
81 is to instead use the assembler specified with \fB--as-cmd\fR.
82 .TP
83 .BI \-d,\ --delay-lib= name
84 Set the delayed import mode for the specified library, which must be
85 one of the libraries imported with the \fB-l\fR option. Delayed mode
86 means that the library won't be loaded until a function imported from
87 it is actually called.
88 .TP
89 .BI \-D\  symbol
90 Ignored for compatibility with the C compiler.
91 .TP
92 .BI \-e,\ --entry= function
93 Specify the module entry point function; if not specified, the default
95 .B DllMain
96 for dlls, and
97 .B main
98 for executables (if the standard C
99 .B main
100 is not defined,
101 .B WinMain
102 is used instead). This is only valid for Win32 modules.
104 .BI \-E,\ --export= filename
105 Specify a .spec file (see \fBSPEC FILE SYNTAX\fR for details), 
106 or a standard Windows .def file that defines the exports
107 of the DLL or executable that is being built.
109 .B \--external-symbols
110 Allow linking to external symbols directly from the spec
111 file. Normally symbols exported by a dll have to be defined in the dll
112 itself; this option makes it possible to use symbols defined in
113 another Unix library (for symbols defined in another dll, a
114 .I forward
115 specification must be used instead).
117 .BI \-f\  option
118 Specify a code generation option. Currently \fB\-fPIC\fR and
119 \fB\-fasynchronous-unwind-tables\fR are supported. Other options are
120 ignored for compatibility with the C compiler.
122 .B \--fake-module
123 Create a fake PE module for a dll or exe, instead of the normal
124 assembly or object file. The PE module contains the resources for the
125 module, but no executable code.
127 .BI \-F,\ --filename= filename
128 Set the file name of the module. The default is to use the base name
129 of the spec file (without any extension).
131 .B \-h, --help
132 Display a usage message and exit.
134 .BI \-H,\ --heap= size
135 Specify the size of the module local heap in bytes (only valid for
136 Win16 modules); default is no local heap.
138 .BI \-I\  directory
139 Ignored for compatibility with the C compiler.
141 .B \-k, --kill-at
142 Remove the stdcall decorations from the symbol names in the
143 generated .def file. Only meaningful in \fB--def\fR mode.
145 .BI \-K\  flags
146 Ignored for compatibility with the C compiler.
148 .BI \--large-address-aware
149 Set a flag in the executable to notify the loader that this
150 application supports address spaces larger than 2 gigabytes.
152 .BI \--ld-cmd= ld-command
153 Specify the command to use to link the object files; the default is
154 \fBld\fR.
156 .BI \-L,\ --library-path= directory
157 Append the specified directory to the list of directories that are
158 searched for import libraries.
160 .BI \-l,\ --library= name
161 Import the specified library, looking for a corresponding
162 \fIlibname.def\fR file in the directories specified with the \fB-L\fR
163 option.
165 .B \-m16, -m32, -m64
166 Generate respectively 16-bit, 32-bit or 64-bit code.
168 .BI \-marm,\ \-mthumb,\ \-march= option ,\ \-mcpu= option ,\ \-mfpu= option ,\ \-mfloat-abi= option
169 Set code generation options for the assembler.
171 .B \-munix
172 Build a library that imports standard functions from the Unix C
173 library instead of the Windows runtime.
175 .BI \-M,\ --main-module= module
176 When building a 16-bit dll, set the name of its 32-bit counterpart to
177 \fImodule\fR. This is used to enforce that the load order for the
178 16-bit dll matches that of the 32-bit one.
180 .BI \-N,\ --dll-name= dllname
181 Set the internal name of the module. It is only used in Win16
182 modules. The default is to use the base name of the spec file (without
183 any extension). This is used for KERNEL, since it lives in
184 KRNL386.EXE. It shouldn't be needed otherwise.
186 .BI \--nm-cmd= nm-command
187 Specify the command to use to get the list of undefined symbols; the
188 default is \fBnm\fR.
190 .BI --nxcompat= yes\fR|\fIno
191 Specify whether the module is compatible with no-exec support. The
192 default is yes.
194 .BI \-o,\ --output= file
195 Set the name of the output file (default is standard output). If the
196 output file name ends in .o, the text output is sent to a
197 temporary file that is then assembled to produce the specified .o
198 file.
200 .BI \-r,\ --res= rsrc.res
201 Load resources from the specified binary resource file. The
202 \fIrsrc.res\fR file can be produced from a source resource file with
203 .BR wrc (1)
204 (or with a Windows resource compiler).
206 This option is only necessary for Win16 resource files, the Win32 ones
207 can simply listed as
208 .I input files
209 and will automatically be handled correctly (though the
210 .B \-r
211 option will also work for Win32 files).
213 .B --save-temps
214 Do not delete the various temporary files that \fBwinebuild\fR generates.
216 .BI --subsystem= subsystem\fR[\fB:\fImajor\fR[\fB.\fIminor\fR]]
217 Set the subsystem of the executable, which can be one of the following:
219 .B console
220 for a command line executable,
222 .B windows
223 for a graphical executable,
225 .B native
226 for a native-mode dll,
228 .B wince
229 for a ce dll.
231 The entry point of a command line executable is a normal C \fBmain\fR
232 function. A \fBwmain\fR function can be used instead if you need the
233 argument array to use Unicode strings. A graphical executable has a
234 \fBWinMain\fR entry point.
236 Optionally a major and minor subsystem version can also be specified;
237 the default subsystem version is 4.0.
239 .BI \-u,\ --undefined= symbol
240 Add \fIsymbol\fR to the list of undefined symbols when invoking the
241 linker. This makes it possible to force a specific module of a static
242 library to be included when resolving imports.
244 .B \-v, --verbose
245 Display the various subcommands being invoked by
246 .BR winebuild .
248 .B \--version
249 Display the program version and exit.
251 .B \-w, --warnings
252 Turn on warnings.
253 .SH "SPEC FILE SYNTAX"
254 .SS "General syntax"
255 A spec file should contain a list of ordinal declarations. The general
256 syntax is the following:
258 .I ordinal functype
259 .RI [ flags ]\  exportname \ \fB(\fR\ [ args... ] \ \fB) \ [ handler ]
261 .IB ordinal\  variable
262 .RI [ flags ]\  exportname \ \fB(\fR\ [ data... ] \ \fB)
264 .IB ordinal\  extern
265 .RI [ flags ]\  exportname \ [ symbolname ]
267 .IB ordinal\  stub
268 .RI [ flags ]\  exportname \ [\ \fB( args... \fB)\fR\ ]
270 .IB ordinal\  equate
271 .RI [ flags ]\  exportname\ data
273 .BI #\  comments
275 Declarations must fit on a single line, except if the end of line is
276 escaped using a backslash character. The
277 .B #
278 character anywhere in a line causes the rest of the line to be ignored
279 as a comment.
281 .I ordinal
282 specifies the ordinal number corresponding to the entry point, or '@'
283 for automatic ordinal allocation (Win32 only).
285 .I flags
286 is a series of optional flags, preceded by a '-' character. The
287 supported flags are:
290 .B -norelay
291 The entry point is not displayed in relay debugging traces (Win32
292 only).
294 .B -noname
295 The entry point will be exported by ordinal instead of by name. The
296 name is still available for importing.
298 .B -ret16
299 The function returns a 16-bit value (Win16 only).
301 .B -ret64
302 The function returns a 64-bit value (Win32 only).
304 .B -register
305 The function uses CPU register to pass arguments.
307 .B -private
308 The function cannot be imported from other dlls, it can only be
309 accessed through GetProcAddress.
311 .B -ordinal
312 The entry point will be imported by ordinal instead of by name. The
313 name is still exported.
315 .B -thiscall
316 The function uses the
317 .I thiscall
318 calling convention (first parameter in %ecx register on i386).
320 .B -fastcall
321 The function uses the
322 .I fastcall
323 calling convention (first two parameters in %ecx/%edx registers on
324 i386).
326 .B -import
327 The function is imported from another module. This can be used instead
328 of a
329 .I forward
330 specification when an application expects to find the function's
331 implementation inside the dll.
333 .B -arch=\fR[\fB!\fR]\fIcpu\fR[\fB,\fIcpu\fR]
334 The entry point is only available on the specified CPU
335 architecture(s). The names \fBwin32\fR and \fBwin64\fR match all
336 32-bit or 64-bit CPU architectures respectively. In 16-bit dlls,
337 specifying \fB-arch=win32\fR causes the entry point to be exported
338 from the 32-bit wrapper module. A CPU name can be prefixed with
339 \fB!\fR to exclude only that specific architecture.
341 .SS "Function ordinals"
342 Syntax:
344 .I ordinal functype
345 .RI [ flags ]\  exportname \ \fB(\fR\ [ args... ] \ \fB) \ [ handler ]
348 This declaration defines a function entry point.  The prototype defined by
349 .IR exportname \ \fB(\fR\ [ args... ] \ \fB)
350 specifies the name available for dynamic linking and the format of the
351 arguments. '@' can be used instead of
352 .I exportname
353 for ordinal-only exports.
355 .I functype
356 should be one of:
359 .B stdcall
360 for a normal Win32 function
362 .B pascal
363 for a normal Win16 function
365 .B cdecl
366 for a Win16 or Win32 function using the C calling convention
368 .B varargs
369 for a Win16 or Win32 function using the C calling convention with a
370 variable number of arguments
373 .I args
374 should be one or several of:
377 .B word
378 (16-bit unsigned value)
380 .B s_word
381 (16-bit signed word)
383 .B long
384 (pointer-sized integer value)
386 .B int64
387 (64-bit integer value)
389 .B int128
390 (128-bit integer value)
392 .B float
393 (32-bit floating point value)
395 .B double
396 (64-bit floating point value)
398 .B ptr
399 (linear pointer)
401 .B str
402 (linear pointer to a null-terminated ASCII string)
404 .B wstr
405 (linear pointer to a null-terminated Unicode string)
407 .B segptr
408 (segmented pointer)
410 .B segstr
411 (segmented pointer to a null-terminated ASCII string).
413 Note: The 16-bit and segmented pointer types are only valid for Win16
414 functions.
417 .I handler
418 is the name of the actual C function that will implement that entry
419 point in 32-bit mode. The handler can also be specified as
420 .IB dllname . function
421 to define a forwarded function (one whose implementation is in another
422 dll). If
423 .I handler
424 is not specified, it is assumed to be identical to
425 .I exportname.
427 This first example defines an entry point for the 32-bit GetFocus()
428 call:
430 @ stdcall GetFocus() GetFocus
432 This second example defines an entry point for the 16-bit
433 CreateWindow() call (the ordinal 100 is just an example); it also
434 shows how long lines can be split using a backslash:
436 100 pascal CreateWindow(ptr ptr long s_word s_word s_word \\
437     s_word word word word ptr) WIN_CreateWindow
439 To declare a function using a variable number of arguments, specify
440 the function as
441 .B varargs
442 and declare it in the C file with a '...' parameter for a Win32
443 function, or with an extra VA_LIST16 argument for a Win16 function.
444 See the wsprintf* functions in user.exe.spec and user32.spec for an
445 example.
446 .SS "Variable ordinals"
447 Syntax:
449 .IB ordinal\  variable
450 .RI [ flags ]\  exportname \ \fB(\fR\ [ data... ] \ \fB)
452 This declaration defines data storage as 32-bit words at the ordinal
453 specified.
454 .I exportname
455 will be the name available for dynamic
456 linking.
457 .I data
458 can be a decimal number or a hex number preceded by "0x".  The
459 following example defines the variable VariableA at ordinal 2 and
460 containing 4 ints:
462 2 variable VariableA(-1 0xff 0 0)
464 This declaration only works in Win16 spec files. In Win32 you should
466 .B extern
467 instead (see below).
468 .SS "Extern ordinals"
469 Syntax:
471 .IB ordinal\  extern
472 .RI [ flags ]\  exportname \ [ symbolname ]
474 This declaration defines an entry that simply maps to a C symbol
475 (variable or function). It only works in Win32 spec files.
476 .I exportname
477 will point to the symbol
478 .I symbolname
479 that must be defined in the C code. Alternatively, it can be of the
480 form
481 .IB dllname . symbolname
482 to define a forwarded symbol (one whose implementation is in another
483 dll). If
484 .I symbolname
485 is not specified, it is assumed to be identical to
486 .I exportname.
487 .SS "Stub ordinals"
488 Syntax:
490 .IB ordinal\  stub
491 .RI [ flags ]\  exportname \ [\ \fB( args... \fB)\fR\ ]
493 This declaration defines a stub function. It makes the name and
494 ordinal available for dynamic linking, but will terminate execution
495 with an error message if the function is ever called.
496 .SS "Equate ordinals"
497 Syntax:
499 .IB ordinal\  equate
500 .RI [ flags ]\  exportname\ data
502 This declaration defines an ordinal as an absolute value.
503 .I exportname
504 will be the name available for dynamic linking.
505 .I data
506 can be a decimal number or a hex number preceded by "0x".
507 .SH AUTHORS
508 .B winebuild
509 has been worked on by many people over the years. The main authors are
510 Robert J. Amstadt, Alexandre Julliard, Martin von Loewis, Ulrich
511 Weigand and Eric Youngdale. Many other people have contributed new features
512 and bug fixes. For a complete list, see the git commit logs.
513 .SH BUGS
514 It is not yet possible to use a PE-format dll in an import
515 specification; only Wine dlls can be imported.
517 Bugs can be reported on the
518 .UR https://bugs.winehq.org
519 .B Wine bug tracker
520 .UE .
521 .SH AVAILABILITY
522 .B winebuild
523 is part of the Wine distribution, which is available through WineHQ,
525 .UR https://www.winehq.org/
526 .B Wine development headquarters
527 .UE .
528 .SH "SEE ALSO"
529 .BR wine (1),
530 .BR winegcc (1),
531 .BR wrc (1),
533 .UR https://www.winehq.org/help
534 .B Wine documentation and support
535 .UE .