Spec file format ---------------- name NAME type win16|win32 [file WINFILENAME] [mode dll|cuiexe|guiexe|cuiexe_unicode|guiexe_unicode] [heap SIZE] [stack SIZE] [init FUNCTION] [import [IMP_FLAGS] DLL] [rsrc RESFILE] [debug_channels ([CHANNEL [CHANNEL...]])] [ignore ([SYMBOL [SYMBOL...]])] ORDINAL FUNCTYPE [FLAGS] EXPORTNAME([ARGTYPE [ARGTYPE [...]]]) HANDLERNAME ORDINAL variable [FLAGS] EXPORTNAME (DATA [DATA [DATA [...]]]) ORDINAL stub [FLAGS] EXPORTNAME ORDINAL equate [FLAGS] EXPORTNAME DATA ORDINAL extern [FLAGS] EXPORTNAME SYMBOLNAME ORDINAL forward [FLAGS] EXPORTNAME SYMBOLNAME # COMMENT_TEXT -------------------- General: ======== "name" and "type" fields are mandatory. Specific ordinal declarations are optional, but the default handler will print an error message. "mode" specifies whether it is the spec file for a dll or the main exe. This is only valid for Win32 spec files. "heap" is the size of the module local heap (only valid for Win16 modules); default is no local heap. "stack" is the stack size for Win32 exe modules, in kilobytes; default size is 1024 (1Mb stack). "file" gives the name of the Windows file that is replaced by the builtin. .DLL is assumed if none is given. (This is important for kernel, which lives in the Windows file KRNL386.EXE). "init" specifies a function which will be called when this dll is loaded. This is only valid for Win32 modules. "import" names a module that this one depends on (only for Win32 modules at the present). The import declaration can be present several times. "IMP_FLAGS" is a series of optional flags, preceded by a '-' character. The supported flags are: "-delay": the module this module depends upon will be loaded when the first API will be called (and not while this module is loaded) "rsrc" specifies the path of the compiled resource file. "debug_channels" specifies the list of debug channels used by the dll. "ignore" specifies a list of symbols that should be ignored when resolving undefined symbols against the imported libraries. "ORDINAL" specified 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 supported flags are: "-noimport": the entry point is not made available for importing from winelib applications (Win32 only). "-norelay": the entry point is not displayed in relay debugging traces (Win32 only). "-ret64": the function returns a 64-bit value (Win32 only). "-i386": the entry point is only available on i386 platforms. Lines whose first character is a '#' will be ignored as comments. Variable ordinals: ================== This type 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 containing 4 ints: 2 variable VariableA(-1 0xff 0 0) Function ordinals: ================== This type defines a function entry point. The prototype defined by "EXPORTNAME ([ARGTYPE [ARGTYPE [...]]])" 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: - "pascal16" for a Win16 function returning a 16-bit value - "pascal" for a Win16 function returning a 32-bit value - "register" for a function using CPU register to pass arguments - "interrupt" for a Win16 interrupt handler routine - "stdcall" for a normal Win32 function - "cdecl" for a Win32 function using the C calling convention - "varargs" for a Win32 function taking a variable number of arguments "ARGTYPE" should be one 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) Only "ptr", "str", "wstr", "long" and "double" are valid for Win32 functions. "HANDLERNAME" is the name of the actual Wine function that will process the request in 32-bit mode. This first example defines an entry point for the CreateWindow() call (the ordinal 100 is just an example): 100 pascal CreateWindow(ptr ptr long s_word s_word s_word s_word word word word ptr) WIN_CreateWindow This second example defines an entry point for the GetFocus() call (the ordinal 100 is just an example): 100 pascal GetFocus() WIN_GetFocus() To declare a function using a variable number of arguments in Win16, specify the function as taking no arguments. The arguments are then available with CURRENT_STACK16->args. In Win32, specify the function as 'varargs' and declare it with a '...' parameter in the C file. See the wsprintf* functions in user.spec and user32.spec for an example. Stub ordinals: ============== This type 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: ================ This type 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 preceeded by "0x". Extern ordinals: ================ This type defines an entry that simply maps to a Wine symbol (variable or function); "EXPORTNAME" will point to the symbol "SYMBOLNAME" that must be defined in C code. This type only works with Win32. Forwarded ordinals: =================== This type defines an entry that is forwarded to another entry point (kind of a symbolic link). "EXPORTNAME" will forward to the entry point "SYMBOLNAME" that must be of the form "DLL.Function". This type only works with Win32.