winebuild.man.in 13.8 KB
Newer Older
1
.\" -*- nroff -*-
2
.TH WINEBUILD 1 "October 2005" "@PACKAGE_STRING@" "Wine Developers Manual"
3 4 5
.SH NAME
winebuild \- Wine dll builder
.SH SYNOPSIS
6
.BI winebuild\  [options]\ [input\ files]
7 8
.SH DESCRIPTION
.B winebuild
9 10
generates the assembly files that are necessary to build a Wine dll,
which is basically a Win32 dll encapsulated inside a Unix library.
11 12 13 14 15 16 17 18 19 20
.PP
.B winebuild
has different modes, depending on what kind of file it is asked to
generate. The mode is specified by one of the mode options specified
below. In addition to the mode option, various other command-line
option can be specified, as described in the \fBOPTIONS\fR section.
.SH "MODE OPTIONS"
You have to specify exactly one of the following options, depending on
what you want winebuild to generate.
.TP
21
.BI \--dll
22
Build an assembly file from a .spec file (see \fBSPEC FILE SYNTAX\fR
23 24 25 26
for details), or from a standard Windows .def file. The .spec/.def
file is specified via the -E option. The resulting file must be
assembled and linked to the other object files to build a working Wine
dll.  In this mode, the
27 28 29 30 31 32
.I input files
should be the list of all object files that will be linked into the
final dll, to allow
.B winebuild
to get the list of all undefined symbols that need to be imported from
other dlls.
33
.TP
34
.BI \--exe
35
Build an assembly file for an executable. This is basically the same as
36 37 38 39
the --dll mode except that it doesn't require a .spec/.def file as input,
since an executable need not export functions. Some executables however
do export functions, and for those a .spec/.def file can be specified via
the -E option. The executable is named from the .spec/.def file name if 
40 41
present, or explicitly through the -F option. The resulting file must be 
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 44
.I input files.
.TP
45 46 47
.BI \--def
Build a .def file from a spec file. The .spec file is specified via the
-E option. This is used when building dlls with a PE (Win32) compiler.
48
.TP
49
.B \--relay16
50 51 52
Generate the assembly code for the 16-bit relay routines. This is for
Wine internal usage only, you should never need to use this option.
.TP
53
.B \--relay32
54 55 56 57
Generate the assembly code for the 32-bit relay routines. This is for
Wine internal usage only, you should never need to use this option.
.SH OPTIONS
.TP
58 59 60 61
.BI \--as-cmd= as-command
Specify the command to use to compile assembly files; the default is
\fBas\fR.
.TP
62 63 64 65 66 67
.BI \-d,\ --delay-lib= name
Set the delayed import mode for the specified library, which must be
one of the libraries imported with the \fB-l\fR option. Delayed mode
means that the library won't be loaded until a function imported from
it is actually called.
.TP
68 69 70
.BI \-D\  symbol
Ignored for compatibility with the C compiler.
.TP
71
.BI \-e,\ --entry= function
72 73 74 75
Specify the module entry point function; if not specified, the default
is
.B DllMain
for dlls, and
76
.B main
77 78 79 80
for executables (if the standard C
.B main
is not defined,
.B WinMain
81
is used instead). This is only valid for Win32 modules.
82
.TP
83 84 85 86 87
.BI \-E,\ --export= filename
Specify a .spec file (see \fBSPEC FILE SYNTAX\fR for details), 
or a standard Windows .def file that defines the exports
of the DLL or executable that is being built.
.TP
88 89 90 91 92 93 94 95
.B \--external-symbols
Allow linking to external symbols directly from the spec
file. Normally symbols exported by a dll have to be defined in the dll
itself; this option makes it possible to use symbols defined in
another Unix library (for symbols defined in another dll, a
.I forward
specification must be used instead).
.TP
96 97 98
.BI \-f\  flags
Ignored for compatibility with the C compiler.
.TP
99
.BI \-F,\ --filename= filename
100 101 102
Set the file name of the module. The default is to use the base name
of the spec file (without any extension).
.TP
103
.B \-h, --help
104 105
Display a usage message and exit.
.TP
106
.BI \-H,\ --heap= size
107 108 109
Specify the size of the module local heap in bytes (only valid for
Win16 modules); default is no local heap.
.TP
110
.BI \-i,\ --ignore= [-]symbol[,[-]symbol]
111 112 113
Specify a list of symbols that should be ignored when resolving
undefined symbols against the imported libraries. This forces these
symbols to be resolved from the Unix C library (or from another Unix
114 115 116
library linked with the application). If a symbol is prefixed by '-'
it is removed from the list instead of being added; a stand-alone '-'
clears the whole list.
117
.TP
118
.BI \-I\  directory
119 120
Ignored for compatibility with the C compiler.
.TP
121
.B \-k, --kill-at
122 123 124
Remove the stdcall decorations from the symbol names in the
generated .def file. Only meaningful in \fB--def\fR mode.
.TP
125 126 127
.BI \-K\  flags
Ignored for compatibility with the C compiler.
.TP
128 129 130 131
.BI \--ld-cmd= ld-command
Specify the command to use to link the object files; the default is
\fBld\fR.
.TP
132
.BI \-L,\ --library-path= directory
133 134 135
Append the specified directory to the list of directories that are
searched for import libraries.
.TP
136
.BI \-l,\ --library= name
137
Import the specified library, looking for a corresponding
138
\fIlibname.def\fR file in the directories specified with the \fB-L\fR
139 140
option.
.TP
141
.BI \-M,\ --main-module= module
142 143
Specify that we are building a 16-bit dll, that will ultimately be
linked together with the 32-bit dll specified in \fImodule\fR.  Only
144
meaningful in \fB--dll\fR mode.
145
.TP
146
.BI \-N,\ --dll-name= dllname
147 148 149 150 151
Set the internal name of the module. It is only used in Win16
modules. The default is to use the base name of the spec file (without
any extension). This is used for KERNEL, since it lives in
KRNL386.EXE. It shouldn't be needed otherwise.
.TP
152 153 154 155
.BI \--nm-cmd= nm-command
Specify the command to use to get the list of undefined symbols; the
default is \fBnm\fR.
.TP
156 157 158 159
.BI --nxcompat= yes|no
Specify whether the module is compatible with no-exec support. The
default is yes.
.TP
160
.BI \-o,\ --output= file
161 162 163 164
Set the name of the output file (default is standard output). If the
output file name end in \fB.o\fR, the text output is sent to a
temporary file that is then assembled to produce the specified .o
file.
165
.TP
166
.BI \-r,\ --res= rsrc.res
167
Load resources from the specified binary resource file. The
168
\fIrsrc.res\fR file can be produced from a source resource file with
169 170
.BR wrc(1)
(or with a Windows resource compiler).
171 172 173 174 175 176 177
.br
This option is only necessary for Win16 resource files, the Win32 ones
can simply listed as
.I input files
and will automatically be handled correctly (though the
.B \-r
option will also work for Win32 files).
178
.TP
179 180 181
.B --save-temps
Do not delete the various temporary files that \fBwinebuild\fR generates.
.TP
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
.BI --subsystem= subsystem[:major[.minor]]
Set the subsystem of the executable, which can be one of the following:
.br
.B console
for a command line executable,
.br
.B windows
for a graphical executable,
.br
.B native
for a native-mode dll.
.br
The entry point of a command line executable is a normal C \fBmain\fR
function. A \fBwmain\fR function can be used instead if you need the
argument array to use Unicode strings. A graphical executable has a
\fBWinMain\fR entry point.
.br
Optionally a major and minor subsystem version can also be specified;
the default subsystem version is 4.0.
.TP
202 203 204 205 206
.BI --target= cpu-manufacturer[-kernel]-os
Specify the target CPU and platform on which the generated code will
be built. The target specification is in the standard autoconf format
as returned by config.sub.
.TP
207 208 209 210 211
.BI \-u,\ --undefined= symbol
Add \fIsymbol\fR to the list of undefined symbols when invoking the
linker. This makes it possible to force a specific module of a static
library to be included when resolving imports.
.TP
212 213 214 215
.B \-v, --verbose
Display the various subcommands being invoked by
.B winebuild.
.TP
216 217 218 219
.B \--version
Display the program version and exit.
.TP
.B \-w, --warnings
220 221 222
Turn on warnings.
.SH "SPEC FILE SYNTAX"
.SS "General syntax"
223 224
A spec file should contain a list of ordinal declarations. The general
syntax is the following:
225 226
.PP
.I ordinal functype
227
.RI [ flags ]\  exportname \ \fB(\fR\ [ args... ] \ \fB) \ [ handler ]
228 229 230 231
.br
.IB ordinal\  variable
.RI [ flags ]\  exportname \ \fB(\fR\ [ data... ] \ \fB)
.br
232
.IB ordinal\  extern
233
.RI [ flags ]\  exportname \ [ symbolname ]
234
.br
235 236 237 238 239 240
.IB ordinal\  stub
.RI [ flags ]\  exportname
.br
.IB ordinal\  equate
.RI [ flags ]\  exportname\ data
.br
241
.BI #\  comments
242
.PP
243 244
Declarations must fit on a single line, except if the end of line is
escaped using a backslash character. The
245
.B #
246 247
character anywhere in a line causes the rest of the line to be ignored
as a comment.
248
.PP
249 250 251 252 253 254 255 256 257 258 259 260 261 262
.I ordinal
specifies the ordinal number corresponding to the entry point, or '@'
for automatic ordinal allocation (Win32 only).
.PP
.I flags
is a series of optional flags, preceded by a '-' character. The
supported flags are:
.RS
.TP
.B -norelay
The entry point is not displayed in relay debugging traces (Win32
only).
.TP
.B -noname
263 264
The entry point will be exported by ordinal instead of by name. The
name is still available for importing.
265
.TP
266 267 268
.B -ret16
The function returns a 16-bit value (Win16 only).
.TP
269 270 271 272 273 274 275
.B -ret64
The function returns a 64-bit value (Win32 only).
.TP
.B -i386
The entry point is only available on i386 platforms.
.TP
.B -register
276
The function uses CPU register to pass arguments.
277
.TP
278 279 280
.B -private
The function cannot be imported from other dlls, it can only be
accessed through GetProcAddress.
281 282 283 284
.TP
.B -ordinal
The entry point will be imported by ordinal instead of by name. The
name is still exported.
285 286 287 288
.SS "Function ordinals"
Syntax:
.br
.I ordinal functype
289
.RI [ flags ]\  exportname \ \fB(\fR\ [ args... ] \ \fB) \ [ handler ]
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305
.br

This declaration defines a function entry point.  The prototype defined by
.IR exportname \ \fB(\fR\ [ args... ] \ \fB)
specifies the name available for dynamic linking and the format of the
arguments. '@' can be used instead of
.I exportname
for ordinal-only exports.
.PP
.I functype
should be one of:
.RS
.TP
.B stdcall
for a normal Win32 function
.TP
306 307 308
.B pascal
for a normal Win16 function
.TP
309
.B cdecl
310
for a Win16 or Win32 function using the C calling convention
311 312
.TP
.B varargs
313 314
for a Win16 or Win32 function using the C calling convention with a
variable number of arguments
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353
.RE
.PP
.I args
should be one or several of:
.RS
.TP
.B word
(16-bit unsigned value)
.TP
.B s_word
(16-bit signed word)
.TP
.B long
(32-bit value)
.TP
.B double
(64-bit value)
.TP
.B ptr
(linear pointer)
.TP
.B str
(linear pointer to a null-terminated ASCII string)
.TP
.B wstr
(linear pointer to a null-terminated Unicode string)
.TP
.B segptr
(segmented pointer)
.TP
.B segstr
(segmented pointer to a null-terminated ASCII string).
.HP
.RB Only\  ptr ,\  str ,\  wstr ,\  long\  and\  double
are valid for Win32 functions.
.RE
.PP
.I handler
is the name of the actual C function that will implement that entry
354 355 356
point in 32-bit mode. The handler can also be specified as
.IB dllname . function
to define a forwarded function (one whose implementation is in another
357 358 359 360
dll). If
.I handler
is not specified, it is assumed to be identical to
.I exportname.
361
.PP
362
This first example defines an entry point for the 32-bit GetFocus()
363 364 365 366
call:
.IP
@ stdcall GetFocus() GetFocus
.PP
367 368 369 370 371 372 373
This second example defines an entry point for the 16-bit
CreateWindow() call (the ordinal 100 is just an example); it also
shows how long lines can be split using a backslash:
.IP
100 pascal CreateWindow(ptr ptr long s_word s_word s_word \\
    s_word word word word ptr) WIN_CreateWindow
.PP
374 375
To declare a function using a variable number of arguments, specify
the function as
376
.B varargs
377 378 379 380
and declare it in the C file with a '...' parameter for a Win32
function, or with an extra VA_LIST16 argument for a Win16 function.
See the wsprintf* functions in user.exe.spec and user32.spec for an
example.
381 382 383 384 385 386 387 388 389 390 391 392
.SS "Variable ordinals"
Syntax:
.br
.IB ordinal\  variable
.RI [ flags ]\  exportname \ \fB(\fR\ [ data... ] \ \fB)
.PP
This declaration defines data storage as 32-bit words at the ordinal
specified.
.I exportname
will be the name available for dynamic
linking.
.I data
393
can be a decimal number or a hex number preceded by "0x".  The
394 395 396 397
following example defines the variable VariableA at ordinal 2 and
containing 4 ints:
.IP
2 variable VariableA(-1 0xff 0 0)
398 399 400 401 402 403 404 405 406
.PP
This declaration only works in Win16 spec files. In Win32 you should
use
.B extern
instead (see below).
.SS "Extern ordinals"
Syntax:
.br
.IB ordinal\  extern
407
.RI [ flags ]\  exportname \ [ symbolname ]
408 409 410 411 412 413 414 415 416 417
.PP
This declaration defines an entry that simply maps to a C symbol
(variable or function). It only works in Win32 spec files.
.I exportname
will point to the symbol
.I symbolname
that must be defined in the C code. Alternatively, it can be of the
form
.IB dllname . symbolname
to define a forwarded symbol (one whose implementation is in another
418 419 420 421
dll). If
.I symbolname
is not specified, it is assumed to be identical to
.I exportname.
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440
.SS "Stub ordinals"
Syntax:
.br
.IB ordinal\  stub
.RI [ flags ]\  exportname
.PP
This declaration defines a stub function. It makes the name and
ordinal available for dynamic linking, but will terminate execution
with an error message if the function is ever called.
.SS "Equate ordinals"
Syntax:
.br
.IB ordinal\  equate
.RI [ flags ]\  exportname\ data
.PP
This declaration defines an ordinal as an absolute value.
.I exportname
will be the name available for dynamic linking.
.I data
441
can be a decimal number or a hex number preceded by "0x".
442 443 444 445 446 447 448 449 450 451 452 453
.SH AUTHORS
.B winebuild
has been worked on by many people over the years. The main authors are
Robert J. Amstadt, Alexandre Julliard, Martin von Loewis, Ulrich
Weigand and Eric Youngdale. Many other Wine developers have
contributed, please check the file Changelog in the Wine distribution
for the complete details.
.SH BUGS
It is not yet possible to use a PE-format dll in an import
specification; only Wine dlls can be imported.
.PP
If you find a bug, please submit a bug report at
454 455
.UR http://bugs.winehq.org
.B http://bugs.winehq.org.
456 457 458 459 460 461 462
.UE
.SH AVAILABILITY
.B winebuild
is part of the wine distribution, which is available through WineHQ,
the
.B wine
development headquarters, at
463 464
.UR http://www.winehq.org/
.B http://www.winehq.org/.
465 466 467
.UE
.SH "SEE ALSO"
.BR wine (1),
468
.BR winegcc (1),
469
.BR wrc (1).