diff --git a/tools/winebuild/parser.c b/tools/winebuild/parser.c index 4ba650673dc..37a18248c81 100644 --- a/tools/winebuild/parser.c +++ b/tools/winebuild/parser.c @@ -136,8 +136,12 @@ static void ParseVariable( ORDDEF *odp ) int *value_array; int n_values; int value_array_size; + const char *token; - const char *token = GetToken(0); + if (SpecType == SPEC_WIN32) + fatal_error( "'variable' not supported in Win32, use 'extern' instead\n" ); + + token = GetToken(0); if (*token != '(') fatal_error( "Expected '(' got '%s'\n", token ); n_values = 0; @@ -290,8 +294,10 @@ static void ParseStub( ORDDEF *odp ) */ static void ParseExtern( ORDDEF *odp ) { - if (SpecType == SPEC_WIN16) fatal_error( "'extern' not supported for Win16\n" ); + if (SpecType == SPEC_WIN16) + fatal_error( "'extern' not supported for Win16, use 'variable' instead\n" ); odp->link_name = xstrdup( GetToken(0) ); + if (strchr( odp->link_name, '.' )) odp->flags |= FLAG_FORWARD; } diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c index 444603acc48..6c7228ad6b6 100644 --- a/tools/winebuild/spec32.c +++ b/tools/winebuild/spec32.c @@ -168,8 +168,12 @@ static int output_exports( FILE *outfile, int nr_exports ) else switch(odp->type) { case TYPE_EXTERN: - fprintf( outfile, " \"\\t.long " __ASM_NAME("%s") "\\n\"\n", odp->link_name ); - break; + if (!(odp->flags & FLAG_FORWARD)) + { + fprintf( outfile, " \"\\t.long " __ASM_NAME("%s") "\\n\"\n", odp->link_name ); + break; + } + /* else fall through */ case TYPE_STDCALL: case TYPE_VARARGS: case TYPE_CDECL: @@ -187,9 +191,6 @@ static int output_exports( FILE *outfile, int nr_exports ) case TYPE_STUB: fprintf( outfile, " \"\\t.long " __ASM_NAME("%s") "\\n\"\n", make_internal_name( odp, "stub" ) ); break; - case TYPE_VARIABLE: - fprintf( outfile, " \"\\t.long " __ASM_NAME("%s") "\\n\"\n", make_internal_name( odp, "var" ) ); - break; default: assert(0); } @@ -299,25 +300,6 @@ static int output_exports( FILE *outfile, int nr_exports ) } } - /* output variables */ - - for (i = 0; i < nb_entry_points; i++) - { - ORDDEF *odp = EntryPoints[i]; - if (odp->type == TYPE_VARIABLE) - { - int j; - fprintf( outfile, " \"%s:\\n\"\n", make_internal_name( odp, "var" ) ); - fprintf( outfile, " \"\\t.long " ); - for (j = 0; j < odp->u.var.n_values; j++) - { - fprintf( outfile, "0x%08x", odp->u.var.values[j] ); - if (j < odp->u.var.n_values-1) fputc( ',', outfile ); - } - fprintf( outfile, "\\n\"\n" ); - } - } - fprintf( outfile, " \"\\t.text\\n\"\n" ); fprintf( outfile, " \"\\t.align %d\\n\"\n", get_alignment(4) ); fprintf( outfile, ");\n\n" ); @@ -850,7 +832,6 @@ void BuildDef32File(FILE *outfile) switch(odp->type) { case TYPE_EXTERN: - case TYPE_VARIABLE: is_data = 1; /* fall through */ case TYPE_VARARGS: diff --git a/tools/winebuild/winebuild.man.in b/tools/winebuild/winebuild.man.in index dbb1a9b0fbe..e317dc74436 100644 --- a/tools/winebuild/winebuild.man.in +++ b/tools/winebuild/winebuild.man.in @@ -196,15 +196,15 @@ syntax is the following: .IB ordinal\ variable .RI [ flags ]\ exportname \ \fB(\fR\ [ data... ] \ \fB) .br +.IB ordinal\ extern +.RI [ flags ]\ exportname\ symbolname +.br .IB ordinal\ stub .RI [ flags ]\ exportname .br .IB ordinal\ equate .RI [ flags ]\ exportname\ data .br -.IB ordinal\ extern -.RI [ flags ]\ exportname\ symbolname -.br .IB ordinal\ forward .RI [ flags ]\ exportname\ forwardname .br @@ -351,6 +351,28 @@ following example defines the variable VariableA at ordinal 2 and containing 4 ints: .IP 2 variable VariableA(-1 0xff 0 0) +.PP +This declaration only works in Win16 spec files. In Win32 you should +use +.B extern +instead (see below). +.SS "Extern ordinals" +Syntax: +.br +.IB ordinal\ extern +.RI [ flags ]\ exportname\ symbolname +.PP +This declaration defines an entry that simply maps to a C symbol +(variable or function). It only works in Win32 spec files. +.I exportname +will point to the symbol +.I symbolname +that must be defined in the C code. Alternatively, it can be of the +form +.IB dllname . symbolname +to define a forwarded symbol (one whose implementation is in another +dll). + .SS "Stub ordinals" Syntax: .br @@ -371,19 +393,6 @@ This declaration defines an ordinal as an absolute value. will be the name available for dynamic linking. .I data can be a decimal number or a hex number preceeded by "0x". -.SS "Extern ordinals" -Syntax: -.br -.IB ordinal\ extern -.RI [ flags ]\ exportname\ symbolname -.PP -This declaration defines an entry that simply maps to a C symbol -(variable or function). -.I exportname -will point to the symbol -.I symbolname -that must be defined in C code. This declaration only works in Win32 -spec files. .SS "Forwarded ordinals" Syntax: .br