Porting fixes.
[wine.git] / tools / winebuild / winebuild.man.in
blob8ad92b0a20574393c039d6a8ea7b6dbff662c973
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=\  filename
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 resulting C file
25 must be compiled and linked to the other object files to build a
26 working Wine dll.
27 .br
28 In that mode, the
29 .I input files
30 should be the list of all object files that will be linked into the
31 final dll, to allow
32 .B winebuild
33 to get the list of all undefined symbols that need to be imported from
34 other dlls.
35 .TP
36 .BI \--exe=\  name
37 Build a C file for the named executable. This is basically the same as
38 the --dll mode except that it doesn't require a .spec file as input,
39 since an executable doesn't export functions. The resulting C file
40 must be compiled and linked to the other object files to build a
41 working Wine executable, and all the other object files must be listed
43 .I input files.
44 .TP
45 .BI \--def=\  file.spec
46 Build a .def file from a spec file. This is used when building dlls
47 with a PE (Win32) compiler.
48 .TP
49 .B \--debug
50 Build a C file containing the definitions for debugging channels. In
51 that mode the
52 .I input files
53 should be a list of C files to search for debug channel
54 definitions. The resulting C file must be compiled and linked with the
55 dll.
56 .TP
57 .B \--relay16
58 Generate the assembly code for the 16-bit relay routines. This is for
59 Wine internal usage only, you should never need to use this option.
60 .TP
61 .B \--relay32
62 Generate the assembly code for the 32-bit relay routines. This is for
63 Wine internal usage only, you should never need to use this option.
64 .SH OPTIONS
65 .TP
66 .BI \-C,\ --source-dir= directory
67 Change to the specified directory before reading source files. Only
68 meaningful in
69 .BR \--debug\  mode.
70 .TP
71 .BI \-D\  symbol
72 Ignored for compatibility with the C compiler.
73 .TP
74 .BI \-e,\ --entry= function
75 Specify the module entry point function; if not specified, the default
77 .B DllMain
78 for dlls, and
79 .B main
81 .B WinMain
82 for CUI or GUI executables respectively. This is only valid for Win32
83 modules.
84 .TP
85 .BI \-f\  flags
86 Ignored for compatibility with the C compiler.
87 .TP
88 .BI \-F,\ --filename= filename
89 Set the file name of the module. The default is to use the base name
90 of the spec file (without any extension).
91 .TP
92 .B \-h, --help
93 Display a usage message and exit.
94 .TP
95 .BI \-H,\ --heap= size
96 Specify the size of the module local heap in bytes (only valid for
97 Win16 modules); default is no local heap.
98 .TP
99 .BI \-i,\ --ignore= [-]symbol[,[-]symbol]
100 Specify a list of symbols that should be ignored when resolving
101 undefined symbols against the imported libraries. This forces these
102 symbols to be resolved from the Unix C library (or from another Unix
103 library linked with the application). If a symbol is prefixed by '-'
104 it is removed from the list instead of being added; a stand-alone '-'
105 clears the whole list.
107 .BI \-I\  directory
108 Ignored for compatibility with the C compiler.
110 .B \-k, --kill-at
111 Remove the stdcall decorations from the symbol names in the
112 generated .def file. Only meaningful in \fB--def\fR mode.
114 .BI \-K\  flags
115 Ignored for compatibility with the C compiler.
117 .BI \-L,\ --library-path= directory
118 Append the specified directory to the list of directories that are
119 searched for import libraries.
121 .BI \-l,\ --library= name
122 Import the specified library, looking for a corresponding
123 \fIlibname.def\fR file in the directories specified with the \fB-L\fR
124 option.
126 .BI \-d,\ --delay-lib= name
127 Same as the \fB-l\fR option, but import the specified library in
128 delayed mode (i.e. the library won't be loaded until a function
129 imported from it is actually called).
131 .BI \-M,\ --main-module= module
132 Specify that we are building a 16-bit dll, that will ultimately be
133 linked together with the 32-bit dll specified in \fImodule\fR.  Only
134 meaningful in \fB--dll\fR mode.
136 .BI \-m,\ --mode= mode
137 Set the executable or dll mode, which can be one of the following:
139 .B cui
140 for a command line ASCII executable,
142 .B gui
143 for a graphical ASCII executable,
145 .B cuiw
146 for a command line Unicode executable,
148 .B guiw
149 for a graphical Unicode executable,
151 .B native
152 for a native-mode dll.
154 A command line executable entry point is a normal C \fBmain\fR
155 function. A graphical executable has a \fBWinMain\fR entry point
156 instead. The ASCII/Unicode distinction applies to the strings that are
157 passed to the entry point.
159 .BI \-N,\ --dll-name= dllname
160 Set the internal name of the module. It is only used in Win16
161 modules. The default is to use the base name of the spec file (without
162 any extension). This is used for KERNEL, since it lives in
163 KRNL386.EXE. It shouldn't be needed otherwise.
165 .BI \-o,\ --output= file
166 Set the name of the output file (default is standard output).
168 .BI \-r,\ --res= rsrc.res
169 Load resources from the specified binary resource file. The
170 \fIrsrc.res\fR can be produced from a source resource file with
171 .BR wrc(1)
172 (or with a Windows resource compiler).
174 This option is only necessary for Win16 resource files, the Win32 ones
175 can simply listed as
176 .I input files
177 and will automatically be handled correctly (though the
178 .B \-r
179 option will also work for Win32 files).
181 .B \--version
182 Display the program version and exit.
184 .B \-w, --warnings
185 Turn on warnings.
186 .SH "SPEC FILE SYNTAX"
187 .SS "General syntax"
188 A spec file should contain a list of ordinal declarations. The general
189 syntax is the following:
191 .I ordinal functype
192 .RI [ flags ]\  exportname \ \fB(\fR\ [ args... ] \ \fB) \ [ handler ]
194 .IB ordinal\  variable
195 .RI [ flags ]\  exportname \ \fB(\fR\ [ data... ] \ \fB)
197 .IB ordinal\  extern
198 .RI [ flags ]\  exportname \ [ symbolname ]
200 .IB ordinal\  stub
201 .RI [ flags ]\  exportname
203 .IB ordinal\  equate
204 .RI [ flags ]\  exportname\ data
206 .BI #\  comments
208 Declarations must fit on a single line, except if the end of line is
209 escaped using a backslash character. The
210 .B #
211 character anywhere in a line causes the rest of the line to be ignored
212 as a comment.
214 .I ordinal
215 specifies the ordinal number corresponding to the entry point, or '@'
216 for automatic ordinal allocation (Win32 only).
218 .I flags
219 is a series of optional flags, preceded by a '-' character. The
220 supported flags are:
223 .B -norelay
224 The entry point is not displayed in relay debugging traces (Win32
225 only).
227 .B -noname
228 The entry point will be imported by ordinal instead of by name.
230 .B -ret16
231 The function returns a 16-bit value (Win16 only).
233 .B -ret64
234 The function returns a 64-bit value (Win32 only).
236 .B -i386
237 The entry point is only available on i386 platforms.
239 .B -register
240 The function uses CPU register to pass arguments.
242 .B -private
243 The function cannot be imported from other dlls, it can only be
244 accessed through GetProcAddress.
245 .SS "Function ordinals"
246 Syntax:
248 .I ordinal functype
249 .RI [ flags ]\  exportname \ \fB(\fR\ [ args... ] \ \fB) \ [ handler ]
252 This declaration defines a function entry point.  The prototype defined by
253 .IR exportname \ \fB(\fR\ [ args... ] \ \fB)
254 specifies the name available for dynamic linking and the format of the
255 arguments. '@' can be used instead of
256 .I exportname
257 for ordinal-only exports.
259 .I functype
260 should be one of:
263 .B stdcall
264 for a normal Win32 function
266 .B pascal
267 for a normal Win16 function
269 .B cdecl
270 for a Win16 or Win32 function using the C calling convention
272 .B varargs
273 for a Win16 or Win32 function using the C calling convention with a
274 variable number of arguments
277 .I args
278 should be one or several of:
281 .B word
282 (16-bit unsigned value)
284 .B s_word
285 (16-bit signed word)
287 .B long
288 (32-bit value)
290 .B double
291 (64-bit value)
293 .B ptr
294 (linear pointer)
296 .B str
297 (linear pointer to a null-terminated ASCII string)
299 .B wstr
300 (linear pointer to a null-terminated Unicode string)
302 .B segptr
303 (segmented pointer)
305 .B segstr
306 (segmented pointer to a null-terminated ASCII string).
308 .RB Only\  ptr ,\  str ,\  wstr ,\  long\  and\  double
309 are valid for Win32 functions.
312 .I handler
313 is the name of the actual C function that will implement that entry
314 point in 32-bit mode. The handler can also be specified as
315 .IB dllname . function
316 to define a forwarded function (one whose implementation is in another
317 dll). If
318 .I handler
319 is not specified, it is assumed to be identical to
320 .I exportname.
322 This first example defines an entry point for the 32-bit GetFocus()
323 call:
325 @ stdcall GetFocus() GetFocus
327 This second example defines an entry point for the 16-bit
328 CreateWindow() call (the ordinal 100 is just an example); it also
329 shows how long lines can be split using a backslash:
331 100 pascal CreateWindow(ptr ptr long s_word s_word s_word \\
332     s_word word word word ptr) WIN_CreateWindow
334 To declare a function using a variable number of arguments, specify
335 the function as
336 .B varargs
337 and declare it in the C file with a '...' parameter for a Win32
338 function, or with an extra VA_LIST16 argument for a Win16 function.
339 See the wsprintf* functions in user.exe.spec and user32.spec for an
340 example.
341 .SS "Variable ordinals"
342 Syntax:
344 .IB ordinal\  variable
345 .RI [ flags ]\  exportname \ \fB(\fR\ [ data... ] \ \fB)
347 This declaration defines data storage as 32-bit words at the ordinal
348 specified.
349 .I exportname
350 will be the name available for dynamic
351 linking.
352 .I data
353 can be a decimal number or a hex number preceeded by "0x".  The
354 following example defines the variable VariableA at ordinal 2 and
355 containing 4 ints:
357 2 variable VariableA(-1 0xff 0 0)
359 This declaration only works in Win16 spec files. In Win32 you should
361 .B extern
362 instead (see below).
363 .SS "Extern ordinals"
364 Syntax:
366 .IB ordinal\  extern
367 .RI [ flags ]\  exportname \ [ symbolname ]
369 This declaration defines an entry that simply maps to a C symbol
370 (variable or function). It only works in Win32 spec files.
371 .I exportname
372 will point to the symbol
373 .I symbolname
374 that must be defined in the C code. Alternatively, it can be of the
375 form
376 .IB dllname . symbolname
377 to define a forwarded symbol (one whose implementation is in another
378 dll). If
379 .I symbolname
380 is not specified, it is assumed to be identical to
381 .I exportname.
382 .SS "Stub ordinals"
383 Syntax:
385 .IB ordinal\  stub
386 .RI [ flags ]\  exportname
388 This declaration defines a stub function. It makes the name and
389 ordinal available for dynamic linking, but will terminate execution
390 with an error message if the function is ever called.
391 .SS "Equate ordinals"
392 Syntax:
394 .IB ordinal\  equate
395 .RI [ flags ]\  exportname\ data
397 This declaration defines an ordinal as an absolute value.
398 .I exportname
399 will be the name available for dynamic linking.
400 .I data
401 can be a decimal number or a hex number preceeded by "0x".
402 .SH AUTHORS
403 .B winebuild
404 has been worked on by many people over the years. The main authors are
405 Robert J. Amstadt, Alexandre Julliard, Martin von Loewis, Ulrich
406 Weigand and Eric Youngdale. Many other Wine developers have
407 contributed, please check the file Changelog in the Wine distribution
408 for the complete details.
409 .SH BUGS
410 It is not yet possible to use a PE-format dll in an import
411 specification; only Wine dlls can be imported.
413 If you find a bug, please submit a bug report at
414 .UR http://bugs.winehq.org
415 .B http://bugs.winehq.org.
417 .SH AVAILABILITY
418 .B winebuild
419 is part of the wine distribution, which is available through WineHQ,
421 .B wine
422 development headquarters, at
423 .UR http://www.winehq.org/
424 .B http://www.winehq.org/.
426 .SH "SEE ALSO"
427 .BR wine (1),
428 .BR wrc (1).