WineBuild Man Page

From Wine-Wiki

Jump to: navigation, search

Contents

[edit] SYNOPSIS

      winebuild [options] [input files]


[edit] DESCRIPTION

      winebuild  generates  the  C  and  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 option can be specified, as described in the OPTIONS section.


[edit] MODE OPTIONS

      You have to specify exactly one of the following options, depending  on
      what you want winebuild to generate.
      --dll=filename
             Build  a  C  file  from  a  .spec file (see SPEC FILE SYNTAX for
             details), or from a standard Windows .def file. The resulting  C
             file  must  be  compiled and linked to the other object files to
             build a working Wine dll.
             In that mode, the input files should be the list of  all  object
             files that will be linked into the final dll, to allow winebuild
             to get the list  of  all  undefined  symbols  that  need  to  be
             imported from other dlls.
      --exe=name
             Build  a  C file for the named executable. This is basically the
             same as the --dll mode except that it doesn't  require  a  .spec
             file as input, since an executable doesn't export functions. The
             resulting C file must be compiled 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=file.spec
             Build a .def file from a spec file. This is used  when  building
             dlls with a PE (Win32) compiler.
      --debug
             Build  a  C  file containing the definitions for debugging chan-
             nels. In that mode the input files should be a list of  C  files
             to  search  for  debug channel definitions. The resulting C file
             must be compiled and linked with the dll.
      --relay16
             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.
      --relay32
             Generate the assembly code for the 32-bit relay  routines.  This
             WinMain  is  not  defined, the standard C main is used instead).
             This is only valid for Win32 modules.
      -f flags
             Ignored for compatibility with the C compiler.
      -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, --ignore=[-]symbol[,[-]symbol]
             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  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.
      -I directory
             Ignored for compatibility with the C compiler.
      -k, --kill-at
             Remove the stdcall decorations from the symbol names in the gen-
             erated .def file. Only meaningful in --def mode.
      -K flags
             Ignored for compatibility with the C compiler.
      --ld-cmd=ld-command
             Specify the command to use to link the object files; the default
             is ld.
      --nm-cmd=nm-command
             Specify the command to use to get the list of undefined symbols;
             the default is nm.
      -L, --library-path=directory
             Append the specified directory to the list of  directories  that
             are searched for import libraries.
      -l, --library=name
             Import  the  specified library, looking for a corresponding lib-
             name.def file in the directories specified with the -L option.
      -d, --delay-lib=name
      -o, --output=file
             Set the name of the output file (default is standard output).
      -r, --res=rsrc.res
             Load  resources  from  the  specified  binary resource file. The
             rsrc.res can be produced from a source resource file with wrc(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  automati-
             cally  be handled correctly (though the -r option will also work
             for Win32 files).
      --subsystem=subsystem[:major[.minor]]
             Set the subsystem of the executable, which can  be  one  of  the
             following:
             console for a command line executable,
             windows for a graphical executable,
             native for a native-mode 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 spec-
             ified; the default subsystem version is 4.0.
      --version
             Display the program version and exit.
      -w, --warnings
             Turn on warnings.


[edit] SPEC FILE SYNTAX

  General syntax
      A  spec file should contain a list of ordinal declarations. The general
      syntax is the following:
      ordinal functype [flags] exportname ( [args...] ) [handler]
      ordinal variable [flags] exportname ( [data...] )
      ordinal extern [flags] exportname [symbolname]
      ordinal stub [flags] exportname
      ordinal equate [flags] exportname data
      # comments
      Declarations must fit on a single line, except if the end  of  line  is
      escaped using a backslash character. The # character anywhere in a line
      causes the rest of the line to be ignored as a comment.
      ordinal specifies the ordinal number corresponding to the entry  point,
      or '@' for automatic ordinal allocation (Win32 only).
      flags  is  a series of optional flags, preceded by a '-' character. The
             -i386  The entry point is only available on i386 platforms.
             -register
                    The function uses CPU register to pass arguments.
             -private
                    The function cannot be imported from other dlls,  it  can
                    only be accessed through GetProcAddress.
  Function ordinals
      Syntax:
      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 conven-
                    tion
             varargs
                    for a Win16 or Win32 function using the C calling conven-
                    tion 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   (32-bit value)
             double (64-bit 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).
      This second example defines an entry point for  the  16-bit  CreateWin-
      dow() 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 preceeded  by  "0x".   The
      following  example defines the variable VariableA at ordinal 2 and con-
      taining 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).
  Extern ordinals
      Syntax:
      ordinal extern [flags] exportname [symbolname]
      This declaration defines an entry that simply maps to a C symbol (vari-
      able 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 sym-
      bolname is not specified, it is assumed to be identical to  exportname.
  Stub ordinals
      Syntax:
      ordinal stub [flags] exportname
      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.
  Equate ordinals
      Syntax:
      ordinal equate [flags] exportname data
      This  declaration  defines an ordinal as an absolute value.  exportname
      If   you   find   a   bug,   please   submit   a    bug    report    at
      http://bugs.winehq.org.


[edit] AVAILABILITY

      winebuild  is part of the wine distribution, which is available through
      WineHQ, the wine development headquarters, at http://www.winehq.org/.


[edit] SEE ALSO

      wine(1), wrc(1).


Wine 20041201 March 2003 WINEBUILD(1)

Personal tools