2 .TH WINEBUILD 1 "March 2003" "@PACKAGE_STRING@" "Wine dll builder"
4 winebuild \- Wine dll builder
6 .BI winebuild\ [options]\ [input\ files]
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
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.
19 You have to specify exactly one of the following options, depending on
20 what you want winebuild to generate.
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
30 should be the list of all object files that will be linked into the
33 to get the list of all undefined symbols that need to be imported from
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
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.
50 Build a C file containing the definitions for debugging channels. In
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
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.
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.
66 .BI \-C,\ --source-dir= directory
67 Change to the specified directory before reading source files. Only
72 Ignored for compatibility with the C compiler.
74 .BI \-e,\ --entry= function
75 Specify the module entry point function; if not specified, the default
82 for CUI or GUI executables respectively. This is only valid for Win32
86 Ignored for compatibility with the C compiler.
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).
93 Display a usage message and exit.
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.
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.
108 Ignored for compatibility with the C compiler.
111 Remove the stdcall decorations from the symbol names in the
112 generated .def file. Only meaningful in \fB--def\fR mode.
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
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:
140 for a command line ASCII executable,
143 for a graphical ASCII executable,
146 for a command line Unicode executable,
149 for a graphical Unicode executable,
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
172 (or with a Windows resource compiler).
174 This option is only necessary for Win16 resource files, the Win32 ones
177 and will automatically be handled correctly (though the
179 option will also work for Win32 files).
182 Display the program version and exit.
186 .SH "SPEC FILE SYNTAX"
188 A spec file should contain a list of ordinal declarations. The general
189 syntax is the following:
192 .RI [ flags ]\ exportname \ \fB(\fR\ [ args... ] \ \fB) \ [ handler ]
194 .IB ordinal\ variable
195 .RI [ flags ]\ exportname \ \fB(\fR\ [ data... ] \ \fB)
198 .RI [ flags ]\ exportname \ [ symbolname ]
201 .RI [ flags ]\ exportname
204 .RI [ flags ]\ exportname\ data
208 Declarations must fit on a single line, except if the end of line is
209 escaped using a backslash character. The
211 character anywhere in a line causes the rest of the line to be ignored
215 specifies the ordinal number corresponding to the entry point, or '@'
216 for automatic ordinal allocation (Win32 only).
219 is a series of optional flags, preceded by a '-' character. The
224 The entry point is not displayed in relay debugging traces (Win32
228 The entry point will be imported by ordinal instead of by name.
231 The function returns a 16-bit value (Win16 only).
234 The function returns a 64-bit value (Win32 only).
237 The entry point is only available on i386 platforms.
240 The function uses CPU register to pass arguments.
243 The function is an interrupt handler routine.
246 The function cannot be imported from other dlls, it can only be
247 accessed through GetProcAddress.
248 .SS "Function ordinals"
252 .RI [ flags ]\ exportname \ \fB(\fR\ [ args... ] \ \fB) \ [ handler ]
255 This declaration defines a function entry point. The prototype defined by
256 .IR exportname \ \fB(\fR\ [ args... ] \ \fB)
257 specifies the name available for dynamic linking and the format of the
258 arguments. '@' can be used instead of
260 for ordinal-only exports.
267 for a normal Win32 function
270 for a normal Win16 function
273 for a Win16 or Win32 function using the C calling convention
276 for a Win16 or Win32 function using the C calling convention with a
277 variable number of arguments
281 should be one or several of:
285 (16-bit unsigned value)
300 (linear pointer to a null-terminated ASCII string)
303 (linear pointer to a null-terminated Unicode string)
309 (segmented pointer to a null-terminated ASCII string).
311 .RB Only\ ptr ,\ str ,\ wstr ,\ long\ and\ double
312 are valid for Win32 functions.
316 is the name of the actual C function that will implement that entry
317 point in 32-bit mode. The handler can also be specified as
318 .IB dllname . function
319 to define a forwarded function (one whose implementation is in another
322 is not specified, it is assumed to be identical to
325 This first example defines an entry point for the 32-bit GetFocus()
328 @ stdcall GetFocus() GetFocus
330 This second example defines an entry point for the 16-bit
331 CreateWindow() call (the ordinal 100 is just an example); it also
332 shows how long lines can be split using a backslash:
334 100 pascal CreateWindow(ptr ptr long s_word s_word s_word \\
335 s_word word word word ptr) WIN_CreateWindow
337 To declare a function using a variable number of arguments, specify
340 and declare it in the C file with a '...' parameter for a Win32
341 function, or with an extra VA_LIST16 argument for a Win16 function.
342 See the wsprintf* functions in user.exe.spec and user32.spec for an
344 .SS "Variable ordinals"
347 .IB ordinal\ variable
348 .RI [ flags ]\ exportname \ \fB(\fR\ [ data... ] \ \fB)
350 This declaration defines data storage as 32-bit words at the ordinal
353 will be the name available for dynamic
356 can be a decimal number or a hex number preceeded by "0x". The
357 following example defines the variable VariableA at ordinal 2 and
360 2 variable VariableA(-1 0xff 0 0)
362 This declaration only works in Win16 spec files. In Win32 you should
366 .SS "Extern ordinals"
370 .RI [ flags ]\ exportname \ [ symbolname ]
372 This declaration defines an entry that simply maps to a C symbol
373 (variable or function). It only works in Win32 spec files.
375 will point to the symbol
377 that must be defined in the C code. Alternatively, it can be of the
379 .IB dllname . symbolname
380 to define a forwarded symbol (one whose implementation is in another
383 is not specified, it is assumed to be identical to
389 .RI [ flags ]\ exportname
391 This declaration defines a stub function. It makes the name and
392 ordinal available for dynamic linking, but will terminate execution
393 with an error message if the function is ever called.
394 .SS "Equate ordinals"
398 .RI [ flags ]\ exportname\ data
400 This declaration defines an ordinal as an absolute value.
402 will be the name available for dynamic linking.
404 can be a decimal number or a hex number preceeded by "0x".
407 has been worked on by many people over the years. The main authors are
408 Robert J. Amstadt, Alexandre Julliard, Martin von Loewis, Ulrich
409 Weigand and Eric Youngdale. Many other Wine developers have
410 contributed, please check the file Changelog in the Wine distribution
411 for the complete details.
413 It is not yet possible to use a PE-format dll in an import
414 specification; only Wine dlls can be imported.
416 If you find a bug, please submit a bug report at
417 .UR http://bugs.winehq.org
418 .B http://bugs.winehq.org.
422 is part of the wine distribution, which is available through WineHQ,
425 development headquarters, at
426 .UR http://www.winehq.org/
427 .B http://www.winehq.org/.