Abey George (of Macadamian/Corel)
[wine/multimedia.git] / tools / build-spec.txt
blob2a68ef5bd23287862620bb676c6ca56b139e4581
1                         Spec file format
2                         ----------------
4 name    NAME
5 type    win16|win32
6 [file   WINFILENAME]
7 [base   ORDINAL]
8 [heap   SIZE]
9 [init   FUNCTION]
10 [import DLL]
12 ORDINAL VARTYPE EXPORTNAME (DATA [DATA [DATA [...]]])
14 ORDINAL FUNCTYPE EXPORTNAME([ARGTYPE [ARGTYPE [...]]]) HANDLERNAME
16 ORDINAL stub EXPORTNAME
18 ORDINAL equate EXPORTNAME DATA
20 ORDINAL extern EXPORTNAME SYMBOLNAME
22 ORDINAL forward EXPORTNAME SYMBOLNAME
24 # COMMENT_TEXT
26 --------------------
27 General:
28 ========
30     "name" and "type" fields are mandatory.  Specific ordinal
31 declarations are optional, but the default handler will print an error
32 message.
34 "base" gives the offset of the first ordinal; default is 0.
36 "heap" is the size of the module local heap (only valid for Win16
37 modules); default is no local heap.
39 "file" gives the name of the Windows file that is replaced by the
40 builtin. <name>.DLL is assumed if none is given. (This is important
41 for kernel, which lives in the Windows file KRNL386.EXE).
43 "init" specifies a function which will be called when this dll
44 is loaded. This is only valid for Win32 modules.
46 "import" names a module that this one depends on (only for Win32
47 modules at the present). The import declaration can be present several
48 times.
50 Lines whose first character is a '#' will be ignored as comments.
53 Variable ordinals:
54 ==================
56     This type defines data storage at the ordinal specified.  You may
57 store items as bytes, 16-bit words, or 32-bit words.
58     "ORDINAL" is replaced by the ordinal number corresponding to the
59 variable.  "VARTYPE" should be "byte", "word" or "long" for 8, 16, or
60 32 bits respectively.  "EXPORTNAME" will be the name available for
61 dynamic linking.  "DATA" can be a decimal number or a hex number preceeded
62 by "0x".  The following example defines the variable "VariableA" at
63 ordinal 2 and containing 4 bytes:
65         2 byte VariableA(-1 0xff 0 0)
67 Function ordinals:
68 ==================
70     This type defines a function entry point.  The prototype defined by
71 "EXPORTNAME ([ARGTYPE [ARGTYPE [...]]])" specifies the name available for
72 dynamic linking and the format of the arguments. "ORDINAL" is replaced
73 by the ordinal number corresponding to the function, or "@" for
74 automatic ordinal allocation (Win32 only).
76 "FUNCTYPE" should be one of:
77 - "pascal16" for a Win16 function returning a 16-bit value
78 - "pascal" for a Win16 function returning a 32-bit value
79 - "register" for a function using CPU register to pass arguments
80 - "interrupt" for a Win16 interrupt handler routine
81 - "stdcall" for a normal Win32 function
82 - "cdecl" for a Win32 function using the C calling convention
83 - "varargs" for a Win32 function taking a variable number of arguments
85 "ARGTYPE" should be one of:
86 - "word"
87 - "long"
88 - "ptr" (linear pointer)
89 - "str" (linear pointer to a null-terminated string)
90 - "s_word" (signed word)
91 - "segptr" (segmented pointer).
92 - "segstr" (segmented pointer to a null-terminated string)
94 Only "ptr", "str" and "long" are valid for Win32 functions.
96 "HANDLERNAME" is the name of the actual Wine function that will
97 process the request in 32-bit mode.
99     This first example defines an entry point for the CreateWindow()
100 call (the ordinal 100 is just an example):
102         100 pascal CreateWindow(ptr ptr long s_word s_word s_word s_word
103                                 word word word ptr)
104                    WIN_CreateWindow
106    This second example defines an entry point for the GetFocus()
107 call (the ordinal 100 is just an example):
109         100 pascal GetFocus() WIN_GetFocus()
111 To declare a function using a variable number of arguments in Win16,
112 specify the function as taking no arguments. The arguments are then
113 available with CURRENT_STACK16->args. In Win32, specify the function
114 as 'varargs' and declare it with a '...' parameter in the C file.  See
115 the wsprintf* functions in user.spec and user32.spec for an example.
117 Stub ordinals:
118 ==============
120     This type defines a stub function. It makes the name and ordinal
121 available for dynamic linking, but will terminate execution with an
122 error message if the function is ever called.
124 Equate ordinals:
125 ================
127     This type defines an ordinal as an absolute value.
128 "ORDINAL" is replaced by the ordinal number corresponding to the
129 variable.  "EXPORTNAME" will be the name available for dynamic linking.  
130 "DATA" can be a decimal number or a hex number preceeded by "0x".
132 Extern ordinals:
133 ================
135     This type defines an entry that simply maps to a Wine symbol
136 (variable or function); "EXPORTNAME" will point to the symbol
137 "SYMBOLNAME" that must be defined in C code. This type only works with
138 Win32.
140 Forwarded ordinals:
141 ===================
143     This type defines an entry that is forwarded to another entry
144 point (kind of a symbolic link). "EXPORTNAME" will forward to the
145 entry point "SYMBOLNAME" that must be of the form "DLL.Function". This 
146 type only works with Win32.