2 * Copyright 1993 Robert J. Amstadt
3 * Copyright 1995 Martin von Loewis
4 * Copyright 1995, 1996, 1997 Alexandre Julliard
5 * Copyright 1997 Eric Youngdale
6 * Copyright 1999 Ulrich Weigand
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #ifndef __WINE_BUILD_H
24 #define __WINE_BUILD_H
26 #ifndef __WINE_CONFIG_H
27 # error You must include config.h to use this header
34 #ifdef NEED_UNDERSCORE_PREFIX
40 #ifdef HAVE_ASM_STRING
41 # define STRING ".string"
43 # define STRING ".ascii"
48 TYPE_VARIABLE
, /* variable */
49 TYPE_PASCAL_16
, /* pascal function with 16-bit return (Win16) */
50 TYPE_PASCAL
, /* pascal function with 32-bit return (Win16) */
51 TYPE_ABS
, /* absolute value (Win16) */
52 TYPE_STUB
, /* unimplemented stub */
53 TYPE_STDCALL
, /* stdcall function (Win32) */
54 TYPE_CDECL
, /* cdecl function (Win32) */
55 TYPE_VARARGS
, /* varargs function (Win32) */
56 TYPE_EXTERN
, /* external symbol (Win32) */
57 TYPE_FORWARD
, /* forwarded function (Win32) */
72 SPEC_MODE_GUIEXE_UNICODE
,
73 SPEC_MODE_CUIEXE_UNICODE
110 /* entry point flags */
111 #define FLAG_NOIMPORT 0x01 /* don't make function available for importing */
112 #define FLAG_NORELAY 0x02 /* don't use relay debugging for this function */
113 #define FLAG_RET64 0x04 /* function returns a 64-bit value */
114 #define FLAG_I386 0x08 /* function is i386 only */
115 #define FLAG_REGISTER 0x10 /* use register calling convention */
116 #define FLAG_INTERRUPT 0x20 /* function is an interrupt handler */
118 /* Offset of a structure field relative to the start of the struct */
119 #define STRUCTOFFSET(type,field) ((int)&((type *)0)->field)
121 /* Offset of register relative to the start of the CONTEXT struct */
122 #define CONTEXTOFFSET(reg) STRUCTOFFSET(CONTEXT86,reg)
124 /* Offset of register relative to the start of the STACK16FRAME struct */
125 #define STACK16OFFSET(reg) STRUCTOFFSET(STACK16FRAME,reg)
127 /* Offset of register relative to the start of the STACK32FRAME struct */
128 #define STACK32OFFSET(reg) STRUCTOFFSET(STACK32FRAME,reg)
130 /* Offset of the stack pointer relative to %fs:(0) */
131 #define STACKOFFSET (STRUCTOFFSET(TEB,cur_stack))
134 #define MAX_ORDINALS 65535
136 /* global functions */
138 extern void *xmalloc (size_t size
);
139 extern void *xrealloc (void *ptr
, size_t size
);
140 extern char *xstrdup( const char *str
);
141 extern char *strupper(char *s
);
142 extern void fatal_error( const char *msg
, ... );
143 extern void fatal_perror( const char *msg
, ... );
144 extern void warning( const char *msg
, ... );
145 extern void output_standard_file_header( FILE *outfile
);
146 extern void dump_bytes( FILE *outfile
, const unsigned char *data
, int len
,
147 const char *label
, int constant
);
148 extern const char *make_c_identifier( const char *str
);
149 extern int get_alignment(int alignBoundary
);
151 extern void add_import_dll( const char *name
, int delay
);
152 extern void add_ignore_symbol( const char *name
);
153 extern int resolve_imports( void );
154 extern int output_imports( FILE *outfile
);
155 extern void load_res32_file( const char *name
);
156 extern int output_resources( FILE *outfile
);
157 extern void load_res16_file( const char *name
);
158 extern int output_res16_data( FILE *outfile
);
159 extern int output_res16_directory( unsigned char *buffer
);
160 extern void output_dll_init( FILE *outfile
, const char *constructor
, const char *destructor
);
161 extern void parse_debug_channels( const char *srcdir
, const char *filename
);
163 extern void BuildGlue( FILE *outfile
, FILE *infile
);
164 extern void BuildRelays16( FILE *outfile
);
165 extern void BuildRelays32( FILE *outfile
);
166 extern void BuildSpec16File( FILE *outfile
);
167 extern void BuildSpec32File( FILE *outfile
);
168 extern void BuildDef32File( FILE *outfile
);
169 extern void BuildDebugFile( FILE *outfile
);
170 extern SPEC_TYPE
ParseTopLevel( FILE *file
, int def_only
);
172 /* global variables */
174 extern int current_line
;
175 extern int nb_entry_points
;
179 extern int DLLHeapSize
;
181 extern int debugging
;
182 extern int stack_size
;
183 extern int nb_debug_channels
;
184 extern int nb_lib_paths
;
185 extern int display_warnings
;
187 extern char DLLName
[80];
188 extern char DLLFileName
[80];
189 extern char owner_name
[80];
190 extern char *init_func
;
191 extern const char *input_file_name
;
192 extern const char *output_file_name
;
193 extern char **debug_channels
;
194 extern char **lib_path
;
196 extern ORDDEF
*EntryPoints
[MAX_ORDINALS
];
197 extern ORDDEF
*Ordinals
[MAX_ORDINALS
];
198 extern ORDDEF
*Names
[MAX_ORDINALS
];
199 extern SPEC_MODE SpecMode
;
201 #endif /* __WINE_BUILD_H */