2 .TH WINEBUILD 1 "December 2002" "@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.
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.
29 should be the list of all object files that will be linked into the
32 to get the list of all undefined symbols that need to be imported from
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
45 Build a .def file from a spec file. This is used when building dlls
46 with a PE (Win32) compiler.
49 Build a C file containing the definitions for debugging channels. In
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
57 Build a C file containing the glue code for the 16-bit calls contained
60 These calls must be specified in the source files using special
61 markers, as described in the \fBGLUE FUNCTIONS\fR section.
64 Generate the assembly code for the 16-bit relay routines. This is for
65 Wine internal usage only, you should never need to use this option.
68 Generate the assembly code for the 32-bit relay routines. This is for
69 Wine internal usage only, you should never need to use this option.
73 Change to the specified directory before reading source files. Only
75 .BR \--debug\ and\ --glue\ modes.
78 Ignored for compatibility with the C compiler.
81 Specify the module entry point function; if not specified, the default
88 for CUI or GUI executables respectively. This is only valid for Win32
92 Ignored for compatibility with the C compiler.
95 Set the file name of the module. The default is to use the base name
96 of the spec file (without any extension).
99 Display a usage message and exit.
102 Specify the size of the module local heap in bytes (only valid for
103 Win16 modules); default is no local heap.
106 Ignored for compatibility with the C compiler.
108 .BI \-i\ [-]symbol[,[-]symbol]
109 Specify a list of symbols that should be ignored when resolving
110 undefined symbols against the imported libraries. This forces these
111 symbols to be resolved from the Unix C library (or from another Unix
112 library linked with the application). If a symbol is prefixed by '-'
113 it is removed from the list instead of being added; a stand-alone '-'
114 clears the whole list.
117 Ignored for compatibility with the C compiler.
120 Remove the stdcall decorations from the symbol names in the
121 generated .def file. Only meaningful in \fB--def\fR mode.
124 Append the specified directory to the list of directories that are
125 searched for import libraries.
128 Import the specified library, looking for a corresponding
129 \fIlib.dll.so\fR file in the directories specified with the \fB-L\fR
133 Same as the \fB-l\fR option, but import the specified library in
134 delayed mode (i.e. the library won't be loaded until a function
135 imported from it is actually called).
138 Specify that we are building a 16-bit dll, that will ultimately be
139 linked together with the 32-bit dll specified in \fImodule\fR. Only
140 meaningful in \fB--spec\fR mode.
143 Set the executable mode, which can be one of the following:
146 for a command line ASCII executable,
149 for a graphical ASCII executable,
152 for a command line Unicode executable,
155 for a graphical Unicode executable.
157 A command line executable entry point is a normal C \fBmain\fR
158 function. A graphical executable has a \fBWinMain\fR entry point
159 instead. The ASCII/Unicode distinction applies to the strings that are
160 passed to the entry point.
162 This option is only meaningful in \fB--exe\fR mode.
165 Set the internal name of the module. It is only used in Win16
166 modules. The default is to use the base name of the spec file (without
167 any extension). This is used for KERNEL, since it lives in
168 KRNL386.EXE. It shouldn't be needed otherwise.
171 Set the name of the output file (default is standard output).
174 Load resources from the specified binary resource file. The
175 \fIrsrc.res\fR can be produced from a source resource file with
177 (or with a Windows resource compiler).
179 This option is only necessary for Win16 resource files, the Win32 ones
182 and will automatically be handled correctly (though the
184 option will also work for Win32 files).
188 .SH "SPEC FILE SYNTAX"
190 A spec file should contain a list of ordinal declarations. The general
191 syntax is the following:
194 .RI [ flags ]\ exportname \ \fB(\fR\ [ args... ] \ \fB)\fI\ handler
196 .IB ordinal\ variable
197 .RI [ flags ]\ exportname \ \fB(\fR\ [ data... ] \ \fB)
200 .RI [ flags ]\ exportname
203 .RI [ flags ]\ exportname\ data
206 .RI [ flags ]\ exportname\ symbolname
209 .RI [ flags ]\ exportname\ forwardname
213 Lines whose first character is a
215 will be ignored as comments.
218 specifies the ordinal number corresponding to the entry point, or '@'
219 for automatic ordinal allocation (Win32 only).
222 is a series of optional flags, preceded by a '-' character. The
227 The entry point is not displayed in relay debugging traces (Win32
231 The entry point will be imported by ordinal instead of by name.
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.
244 .SS "Function ordinals"
248 .RI [ flags ]\ exportname \ \fB(\fR\ [ args... ] \ \fB)\fI\ handler
251 This declaration defines a function entry point. The prototype defined by
252 .IR exportname \ \fB(\fR\ [ args... ] \ \fB)
253 specifies the name available for dynamic linking and the format of the
254 arguments. '@' can be used instead of
256 for ordinal-only exports.
263 for a normal Win32 function
266 for a Win32 function using the C calling convention
269 for a Win32 function taking a variable number of arguments
272 for a Win16 function returning a 32-bit value
275 for a Win16 function returning a 16-bit value.
279 should be one or several of:
283 (16-bit unsigned value)
298 (linear pointer to a null-terminated ASCII string)
301 (linear pointer to a null-terminated Unicode string)
307 (segmented pointer to a null-terminated ASCII string).
309 .RB Only\ ptr ,\ str ,\ wstr ,\ long\ and\ double
310 are valid for Win32 functions.
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
320 This first example defines an entry point for the 16-bit
321 CreateWindow() call (the ordinal 100 is just an example):
323 100 pascal CreateWindow(ptr ptr long s_word s_word s_word s_word word word word ptr) WIN_CreateWindow
325 This second example defines an entry point for the 32-bit GetFocus()
328 @ stdcall GetFocus() GetFocus
330 To declare a function using a variable number of arguments in Win16,
331 specify the function as taking no arguments. The arguments are then
332 available with CURRENT_STACK16->args. In Win32, specify the function
335 and declare it with a '...' parameter in the C file. See the
336 wsprintf* functions in user.spec and user32.spec for an example.
337 .SS "Variable ordinals"
340 .IB ordinal\ variable
341 .RI [ flags ]\ exportname \ \fB(\fR\ [ data... ] \ \fB)
343 This declaration defines data storage as 32-bit words at the ordinal
346 will be the name available for dynamic
349 can be a decimal number or a hex number preceeded by "0x". The
350 following example defines the variable VariableA at ordinal 2 and
353 2 variable VariableA(-1 0xff 0 0)
358 .RI [ flags ]\ exportname
360 This declaration defines a stub function. It makes the name and
361 ordinal available for dynamic linking, but will terminate execution
362 with an error message if the function is ever called.
363 .SS "Equate ordinals"
367 .RI [ flags ]\ exportname\ data
369 This declaration defines an ordinal as an absolute value.
371 will be the name available for dynamic linking.
373 can be a decimal number or a hex number preceeded by "0x".
374 .SS "Extern ordinals"
378 .RI [ flags ]\ exportname\ symbolname
380 This declaration defines an entry that simply maps to a C symbol
381 (variable or function).
383 will point to the symbol
385 that must be defined in C code. This declaration only works in Win32
387 .SS "Forwarded ordinals"
391 .RI [ flags ]\ exportname\ forwardname
393 This declaration defines an entry that is forwarded to another entry
394 point (kind of a symbolic link).
399 that must be of the form
401 This declaration only works in Win32 spec files.
403 Glue functions are used to call down to 16-bit code from a 32-bit
404 function. This is done by declaring a special type of function
405 prototype in the source file that needs to call to 16-bit code, and
406 processing the source file through
409 These prototypes must be of one of the following forms:
411 .B extern WORD CALLBACK \fIprefix\fB_CallTo16_word_\fIxxx\fB( FARPROC16 func, \fIargs\fB );
413 .B extern LONG CALLBACK \fIprefix\fB_CallTo16_long_\fIxxx\fB( FARPROC16 func, \fIargs\fB );
417 can be anything you need to make the function names unique inside a
420 characters specify the type of the arguments, with one letter for each
421 argument. A \fBw\fR indicates a WORD argument, a \fBl\fR indicates a
424 All the CallTo16 prototypes must be located between the special
426 .B ### start build ###
428 .B ### stop build ###
429 (which have to be inside C comments of course).
431 Here's what a real life example looks like:
433 .B /* ### start build ### */
435 .B extern WORD CALLBACK PRTDRV_CallTo16_word_ww(FARPROC16,WORD,WORD);
437 .B /* ### stop build ### */
440 has been worked on by many people over the years. The main authors are
441 Robert J. Amstadt, Alexandre Julliard, Martin von Loewis, Ulrich
442 Weigand and Eric Youngdale. Many other Wine developers have
443 contributed, please check the file Changelog in the Wine distribution
444 for the complete details.
446 It is not yet possible to use a PE-format dll in an import
447 specification; only Wine dlls can be imported.
449 If you find a bug, please submit a bug report at
450 .UR http://bugs.winehq.com
451 .B http://bugs.winehq.com.
455 is part of the wine distribution, which is available through WineHQ,
458 development headquarters, at
459 .UR http://www.winehq.com/
460 .B http://www.winehq.com/.