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
10 #define __WINE_BUILD_H
12 #ifndef __WINE_CONFIG_H
13 # error You must include config.h to use this header
19 #ifdef NEED_UNDERSCORE_PREFIX
25 #ifdef HAVE_ASM_STRING
26 # define STRING ".string"
28 # define STRING ".ascii"
31 #if defined(__GNUC__) && !defined(__svr4__)
39 TYPE_VARIABLE, /* variable */
40 TYPE_PASCAL_16, /* pascal function with 16-bit return (Win16) */
41 TYPE_PASCAL, /* pascal function with 32-bit return (Win16) */
42 TYPE_ABS, /* absolute value (Win16) */
43 TYPE_STUB, /* unimplemented stub */
44 TYPE_STDCALL, /* stdcall function (Win32) */
45 TYPE_CDECL, /* cdecl function (Win32) */
46 TYPE_VARARGS, /* varargs function (Win32) */
47 TYPE_EXTERN, /* external symbol (Win32) */
48 TYPE_FORWARD, /* forwarded function (Win32) */
64 SPEC_MODE_GUIEXE_UNICODE,
65 SPEC_MODE_CUIEXE_UNICODE
102 /* entry point flags */
103 #define FLAG_NOIMPORT 0x01 /* don't make function available for importing */
104 #define FLAG_NORELAY 0x02 /* don't use relay debugging for this function */
105 #define FLAG_RET64 0x04 /* function returns a 64-bit value */
106 #define FLAG_I386 0x08 /* function is i386 only */
107 #define FLAG_REGISTER 0x10 /* use register calling convention */
108 #define FLAG_INTERRUPT 0x20 /* function is an interrupt handler */
110 /* Offset of a structure field relative to the start of the struct */
111 #define STRUCTOFFSET(type,field) ((int)&((type *)0)->field)
113 /* Offset of register relative to the start of the CONTEXT struct */
114 #define CONTEXTOFFSET(reg) STRUCTOFFSET(CONTEXT86,reg)
116 /* Offset of register relative to the start of the STACK16FRAME struct */
117 #define STACK16OFFSET(reg) STRUCTOFFSET(STACK16FRAME,reg)
119 /* Offset of register relative to the start of the STACK32FRAME struct */
120 #define STACK32OFFSET(reg) STRUCTOFFSET(STACK32FRAME,reg)
122 /* Offset of the stack pointer relative to %fs:(0) */
123 #define STACKOFFSET (STRUCTOFFSET(TEB,cur_stack))
126 #define MAX_ORDINALS 65535
128 /* global functions */
130 extern void *xmalloc (size_t size);
131 extern void *xrealloc (void *ptr, size_t size);
132 extern char *xstrdup( const char *str );
133 extern char *strupper(char *s);
134 extern void fatal_error( const char *msg, ... );
135 extern void fatal_perror( const char *msg, ... );
136 extern void warning( const char *msg, ... );
137 extern void dump_bytes( FILE *outfile, const unsigned char *data, int len,
138 const char *label, int constant );
139 extern int get_alignment(int alignBoundary);
141 extern void add_import_dll( const char *name, int delay );
142 extern void add_ignore_symbol( const char *name );
143 extern int resolve_imports( void );
144 extern int output_imports( FILE *outfile );
145 extern void load_res32_file( const char *name );
146 extern int output_resources( FILE *outfile );
147 extern void load_res16_file( const char *name );
148 extern int output_res16_data( FILE *outfile );
149 extern int output_res16_directory( unsigned char *buffer );
151 extern void BuildGlue( FILE *outfile, FILE *infile );
152 extern void BuildRelays16( FILE *outfile );
153 extern void BuildRelays32( FILE *outfile );
154 extern void BuildSpec16File( FILE *outfile );
155 extern void BuildSpec32File( FILE *outfile );
156 extern void BuildDef32File( FILE *outfile );
157 extern SPEC_TYPE ParseTopLevel( FILE *file );
159 /* global variables */
161 extern int current_line;
162 extern int nb_entry_points;
166 extern int DLLHeapSize;
168 extern int debugging;
169 extern int stack_size;
170 extern int nb_debug_channels;
171 extern int nb_lib_paths;
173 extern char DLLName[80];
174 extern char DLLFileName[80];
175 extern char owner_name[80];
176 extern char *init_func;
177 extern const char *input_file_name;
178 extern const char *output_file_name;
179 extern char **debug_channels;
180 extern char **lib_path;
182 extern ORDDEF *EntryPoints[MAX_ORDINALS];
183 extern ORDDEF *Ordinals[MAX_ORDINALS];
184 extern ORDDEF *Names[MAX_ORDINALS];
185 extern SPEC_MODE SpecMode;
187 #endif /* __WINE_BUILD_H */