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