WINEBUILD(1)
π WINEBUILD(1) β Wine Developers Manual π
πΈ NAME πΈ
winebuild β the Wine dll builder π οΈβ¨
π SYNOPSIS π
winebuild [options] [inputfile...]
π¦ DESCRIPTION π¦
Okay bestie, so winebuild generates the assembly files that are necessary to build a Wine dll, which is basically a Win32 dll encapsulated inside a Unix library. π
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 options can be specified, as described in the OPTIONS section. π«Ά
π MODE OPTIONS π
π¨ Mode check, bestie: you have to specify exactly one of the following options, depending on what you want winebuild to generate.
--dllβ Build an assembly file from a.specfile (see SPEC FILE SYNTAX for details), or from a standard Windows.deffile. The.spec/.deffile is specified via the-Eoption. The resulting file must be assembled and linked to the other object files to build a working Wine dll. In this mode, the input files should be the list of all object files that will be linked into the final dll, to allowwinebuildto get the list of all undefined symbols that need to be imported from other dlls. π§--exeβ Build an assembly file for an executable. This is basically the same as the--dllmode except that it doesn't require a.spec/.deffile as input, since an executable need not export functions. Some executables however do export functions, and for those a.spec/.deffile can be specified via the-Eoption. The executable is named from the.spec/.deffile name if present, or explicitly through the-Foption. The resulting file must be assembled and linked to the other object files to build a working Wine executable, and all the other object files must be listed as input files. π--defβ Build a.deffile from a spec file. The.specfile is specified via the-Eoption. This is used when building dlls with a PE (Win32) compiler. π--implibβ Build a.aimport library from a spec file. The.specfile is specified via the-Eoption. If the output library name ends in.delay.a, a delayed import library is built. π--staticlibβ Build a.astatic library from object files. π--resourcesβ Generate a.ofile containing all the input resources. This is useful when building with a PE compiler, since the PE binutils cannot handle multiple resource files as input. For a standard Unix build, the resource files are automatically included when building the spec file, so there's no need for an intermediate.ofile. π§Ί--builtinβ Mark a PE module as a Wine builtin module, by adding the"Wine builtin DLL"signature string after the DOS header. π--fixup-ctorsβ Fixup constructors after a module has been built. This should be done on the final.somodule if its code contains constructors, to ensure that Wine has a chance to initialize the module before the constructors are executed. π§
β¨ OPTIONS β¨
Here's the whole menu, bestie β every flag, every default, no skips. π
--as-cmd=as-commandβ Specify the command to use to compile assembly files; the default isas. π οΈ-b,--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 byconfig.sub. π-B directoryβ Add thedirectoryto the search path for the various binutils tools likeas,nmandld. π--cc-cmd=cc-commandβ Specify the C compiler to use to compile assembly files; the default is to instead use the assembler specified with--as-cmd. π§°--data-onlyβ Build a module that contains only data and resources, and no executable code. With this option,winebuilddirectly outputs a PE file, instead of an assembly or object file. π¦-d,--delay-lib=nameβ Set the delayed import mode for the specified library, which must be one of the libraries imported with the-loption. Delayed mode means that the library won't be loaded until a function imported from it is actually called. β³-D symbolβ Ignored for compatibility with the C compiler. π--disable-dynamicbaseβ Disable 'ASLR' address space layout randomization in executable image. The default is 'ASLR' enabled. π²-e,--entry=functionβ Specify the module entry point function; if not specified, the default isDllMainfor dlls, andmainfor executables (if the standard Cmainis not defined,WinMainis used instead). This is only valid for Win32 modules. πͺ-E,--export=filenameβ Specify a.specfile (see SPEC FILE SYNTAX for details), or a standard Windows.deffile that defines the exports of the DLL or executable that is being built. π€--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 forward specification must be used instead). π-f optionβ Specify a code generation option. Currently-fPICand-fasynchronous-unwind-tablesare supported. Other options are ignored for compatibility with the C compiler. βοΈ--fake-moduleβ Create a fake PE module for a dll or exe, instead of the normal assembly or object file. The PE module contains the resources for the module, but no executable code. π-F,--filename=filenameβ Set the file name of the module. The default is to use the base name of the spec file (without any extension). π·οΈ-h,--helpβ Display a usage message and exit. π-H,--heap=sizeβ Specify the size of the module local heap in bytes (only valid for Win16 modules); default is no local heap. π§Ί-I directoryβ Ignored for compatibility with the C compiler. π-k,--kill-atβ Remove the stdcall decorations from the symbol names in the generated.deffile. Only meaningful in--defmode. βοΈ-K flagsβ Ignored for compatibility with the C compiler. π--large-address-awareβ Set a flag in the executable to notify the loader that this application supports address spaces larger than 2 gigabytes. π--ld-cmd=ld-commandβ Specify the command to use to link the object files; the default isld. π-m16,-m32,-m64β Generate respectively 16-bit, 32-bit or 64-bit code. π§¬-march=option,-mcpu=option,-mfpu=optionβ Set code generation options for the assembler. π οΈ-mno-cygwinβ Build a library that uses the Windows runtime instead of the Unix C library. πͺ-M,--main-module=moduleβ When building a 16-bit dll, set the name of its 32-bit counterpart to module. This is used to enforce that the load order for the 16-bit dll matches that of the 32-bit one. π§©-N,--dll-name=dllnameβ 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 forKERNEL, since it lives inKRNL386.EXE. It shouldn't be needed otherwise. π--nm-cmd=nm-commandβ Specify the command to use to get the list of undefined symbols; the default isnm. π--nxcompat=yes|noβ Specify whether the module is compatible with no-exec support. The default isyes. π‘οΈ-o,--output=fileβ Set the name of the output file (default is standard output). If the output file name ends in.o, the text output is sent to a temporary file that is then assembled to produce the specified.ofile. π--prefer-nativeβ Specify that the native DLL should be preferred if available at run time. This can be used on modules that are mostly unimplemented. π-r,--res=rsrc.resβ Load resources from the specified binary resource file. Thersrc.resfile can be produced from a source resource file withwrc(1)(or with a Windows resource compiler). This option is only necessary for Win16 resource files, the Win32 ones can simply listed as input files and will automatically be handled correctly (though the-roption will also work for Win32 files). π§Ί--safesehβ Mark object files as SEH compatible. π‘οΈ--save-tempsβ Do not delete the various temporary files thatwinebuildgenerates. πΎ--strip-cmd=strip-commandβ Specify the command to use to strip PE modules. Only meaningful in--builtinmode. βοΈ--subsystem=subsystem[:major[.minor]]β Set the subsystem of the executable, which can be one of the following:consolefor a command line executable,windowsfor a graphical executable,nativefor a native-mode dll,wincefor a ce dll.
The entry point of a command line executable is a normal C main function. A wmain function can be used instead if you need the argument array to use Unicode strings. A graphical executable has a WinMain entry point.
Optionally a major and minor subsystem version can also be specified; the default subsystem version is 4.0. π₯οΈ
-u,--undefined=symbolβ Addsymbolto 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. π-v,--verboseβ Display the various subcommands being invoked bywinebuild. π--versionβ Display the program version and exit. π·οΈ-w,--warningsβ Turn on warnings. β οΈ--without-dlltoolβ Generate import library without usingdlltool. π«
π§ SPEC FILE SYNTAX π§
πΈ General syntax πΈ
Bestie, a spec file is literally just a list of ordinal declarations. The general syntax goes like this:
ordinal functype [flags] exportname ( [args...] ) [handler]
ordinal variable [flags] exportname ( [data...] )
ordinal extern [flags] exportname [symbolname]
ordinal stub [flags] exportname [ (args...) ]
ordinal equate [flags] exportname data
# comments
Declarations have to fit on a single line, unless the end of the line is escaped with a backslash character. And the # character anywhere in a line makes the rest of that line get ignored as a comment. Periodt.
ordinal is the ordinal number that corresponds to the entry point β or '@' for automatic ordinal allocation (Win32 only).
flags is a little stack of optional flags, preceded by a - character. The supported flags are:
-norelayβ the entry point is not displayed in relay debugging traces (Win32 only).-nonameβ the entry point will be exported by ordinal instead of by name. The name is still available for importing.-ret16β the function returns a 16-bit value (Win16 only).-ret64β the function returns a 64-bit value (Win32 only).-registerβ the function uses CPU register to pass arguments.-privateβ the function cannot be imported from other dlls, it can only be accessed throughGetProcAddress.-ordinalβ the entry point will be imported by ordinal instead of by name. The name is still exported.-thiscallβ the function uses the thiscall calling convention (first parameter in%ecxregister on i386).-fastcallβ the function uses the fastcall calling convention (first two parameters in%ecx/%edxregisters on i386).-syscall[=number]β the function is an NT system call. A system call thunk will be generated, and the actual function will be called by the__wine_syscall_dispatcherfunction inntdll. The system call number can be specified explicitly; by default it will be assigned sequentially starting from0.-importβ the function is imported from another module. This can be used instead of a forward specification when an application expects to find the function's implementation inside the dll.-arch=[!]cpu[,cpu]β the entry point is only available on the specified CPU architecture(s). The nameswin32andwin64match all 32-bit or 64-bit CPU architectures respectively. In 16-bit dlls, specifying-arch=win32causes the entry point to be exported from the 32-bit wrapper module. A CPU name can be prefixed with!to exclude only that specific architecture.
π Function ordinals π
Syntax, bestie:
ordinal functype [flags] exportname ( [args...] ) [handler]
This declaration defines a function entry point. The prototype defined by exportname ( [args...] ) specifies the name available for dynamic linking and the format of the arguments. '@' can be used instead of exportname for ordinal-only exports.
functype should be one of:
stdcallβ for a normal Win32 function.pascalβ for a normal Win16 function.cdeclβ for a Win16 or Win32 function using the C calling convention.varargsβ for a Win16 or Win32 function using the C calling convention with a variable number of arguments.
args should be one or several of:
wordβ (16-bit unsigned value)s_wordβ (16-bit signed word)longβ (pointer-sized integer value)int64β (64-bit integer value)int128β (128-bit integer value)floatβ (32-bit floating point value)doubleβ (64-bit floating point value)ptrβ (linear pointer)strβ (linear pointer to a null-terminated ASCII string)wstrβ (linear pointer to a null-terminated Unicode string)segptrβ (segmented pointer)segstrβ (segmented pointer to a null-terminated ASCII string).
Note: The 16-bit and segmented pointer types are only valid for Win16 functions.
handler is the name of the actual C function that will implement that entry point in 32-bit mode. The handler can also be specified as dllname.function to define a forwarded function β one whose implementation is in another dll. If handler is not specified, it is assumed to be identical to exportname.
This first example defines an entry point for the 32-bit GetFocus() call:
@ stdcall GetFocus() GetFocus
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:
100 pascal CreateWindow(ptr ptr long s_word s_word s_word \
s_word word word word ptr) WIN_CreateWindow
To declare a function using a variable number of arguments, specify the function as varargs 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.
π Variable ordinals π
Syntax:
ordinal variable [flags] exportname ( [data...] )
This declaration defines data storage as 32-bit words at the ordinal specified. exportname will be the name available for dynamic linking. data can be a decimal number or a hex number preceded by 0x.
The following example defines the variable VariableA at ordinal 2 and containing 4 ints:
2 variable VariableA(-1 0xff 0 0)
This declaration only works in Win16 spec files. In Win32 you should use extern instead (see below), bestie.
π¦ Extern ordinals π¦
Syntax:
ordinal extern [flags] exportname [symbolname]
This declaration defines an entry that simply maps to a C symbol (variable or function). It only works in Win32 spec files. exportname will point to the symbol symbolname that must be defined in the C code. Alternatively, it can be of the form dllname.symbolname to define a forwarded symbol β one whose implementation is in another dll. If symbolname is not specified, it is assumed to be identical to exportname.
π Stub ordinals π
Syntax:
ordinal stub [flags] exportname [ (args...) ]
This declaration defines a stub function. It makes the name and ordinal available for dynamic linking, but it will terminate execution with an error message if the function is ever called. So like⦠it exists, but it's giving "do not touch" energy, fr fr.
π§ Equate ordinals π§
Syntax:
ordinal equate [flags] exportname data
This declaration defines an ordinal as an absolute value. exportname will be the name available for dynamic linking. data can be a decimal number or a hex number preceded by 0x.
π Api sets π
Syntax:
apiset apiset_dll = target.dll [host.dll:target.dll]
This declaration defines that the apiset_dll (of the form api-ms-*) resolves to the target dll. Optionally other targets can be specified to resolve differently for specific host dlls. For example:
api-ms-win-core-processenvironment-l1-1-0 = kernelbase.dll
api-ms-win-core-processthreads-l1-1-0 = kernel32.dll \
kernel32.dll:kernelbase.dll
If apisets are defined, a corresponding .apiset section will be generated in the PE binary. This requires building the module with the --data-only option.
π AUTHORS π
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 people have contributed new features and bug fixes. For a complete list, see the git commit logs. Iconic collaborative behavior, honestly.
π BUGS π
It is not yet possible to use a PE-format dll in an import specification; only Wine dlls can be imported.
Bugs can be reported on the Wine bug tracker.
π AVAILABILITY π
winebuild is part of the Wine distribution, which is available through WineHQ, the Wine development headquarters.
β SEE ALSO β
wine(1), winegcc(1), wrc(1), Wine documentation and support.
okay bestie, that's the whole page π this version is Wine 11.21, dated October 2005, and the footer energy is WINEBUILD(1) π«Άβ¨
π¦ where this page comes from
- arch rolling: wine 11.21-1 Β· LGPL-2.1-or-later
- arch rolling: wine-staging 11.21-1 Β· LGPL-2.1-or-later
- nixpkgs unstable: wine 11.21
- nixpkgs unstable: wine-staging 11.21
- nixpkgs unstable: wine-wow64 11.21
- nixpkgs unstable: wine-wow64-staging 11.21
- nixpkgs unstable: wine64 11.21
- nixpkgs unstable: wine64-staging 11.21
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms