Disable 'variable' in Win32 spec files.

Added support for forwarded 'extern' ordinals.
This commit is contained in:
Alexandre Julliard 2003-03-17 00:02:11 +00:00
parent 7c7bd1c359
commit 52ec0a3ff3
3 changed files with 39 additions and 43 deletions

View File

@ -136,8 +136,12 @@ static void ParseVariable( ORDDEF *odp )
int *value_array; int *value_array;
int n_values; int n_values;
int value_array_size; 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 ); if (*token != '(') fatal_error( "Expected '(' got '%s'\n", token );
n_values = 0; n_values = 0;
@ -290,8 +294,10 @@ static void ParseStub( ORDDEF *odp )
*/ */
static void ParseExtern( 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) ); odp->link_name = xstrdup( GetToken(0) );
if (strchr( odp->link_name, '.' )) odp->flags |= FLAG_FORWARD;
} }

View File

@ -168,8 +168,12 @@ static int output_exports( FILE *outfile, int nr_exports )
else switch(odp->type) else switch(odp->type)
{ {
case TYPE_EXTERN: case TYPE_EXTERN:
fprintf( outfile, " \"\\t.long " __ASM_NAME("%s") "\\n\"\n", odp->link_name ); if (!(odp->flags & FLAG_FORWARD))
break; {
fprintf( outfile, " \"\\t.long " __ASM_NAME("%s") "\\n\"\n", odp->link_name );
break;
}
/* else fall through */
case TYPE_STDCALL: case TYPE_STDCALL:
case TYPE_VARARGS: case TYPE_VARARGS:
case TYPE_CDECL: case TYPE_CDECL:
@ -187,9 +191,6 @@ static int output_exports( FILE *outfile, int nr_exports )
case TYPE_STUB: case TYPE_STUB:
fprintf( outfile, " \"\\t.long " __ASM_NAME("%s") "\\n\"\n", make_internal_name( odp, "stub" ) ); fprintf( outfile, " \"\\t.long " __ASM_NAME("%s") "\\n\"\n", make_internal_name( odp, "stub" ) );
break; break;
case TYPE_VARIABLE:
fprintf( outfile, " \"\\t.long " __ASM_NAME("%s") "\\n\"\n", make_internal_name( odp, "var" ) );
break;
default: default:
assert(0); 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.text\\n\"\n" );
fprintf( outfile, " \"\\t.align %d\\n\"\n", get_alignment(4) ); fprintf( outfile, " \"\\t.align %d\\n\"\n", get_alignment(4) );
fprintf( outfile, ");\n\n" ); fprintf( outfile, ");\n\n" );
@ -850,7 +832,6 @@ void BuildDef32File(FILE *outfile)
switch(odp->type) switch(odp->type)
{ {
case TYPE_EXTERN: case TYPE_EXTERN:
case TYPE_VARIABLE:
is_data = 1; is_data = 1;
/* fall through */ /* fall through */
case TYPE_VARARGS: case TYPE_VARARGS:

View File

@ -196,15 +196,15 @@ syntax is the following:
.IB ordinal\ variable .IB ordinal\ variable
.RI [ flags ]\ exportname \ \fB(\fR\ [ data... ] \ \fB) .RI [ flags ]\ exportname \ \fB(\fR\ [ data... ] \ \fB)
.br .br
.IB ordinal\ extern
.RI [ flags ]\ exportname\ symbolname
.br
.IB ordinal\ stub .IB ordinal\ stub
.RI [ flags ]\ exportname .RI [ flags ]\ exportname
.br .br
.IB ordinal\ equate .IB ordinal\ equate
.RI [ flags ]\ exportname\ data .RI [ flags ]\ exportname\ data
.br .br
.IB ordinal\ extern
.RI [ flags ]\ exportname\ symbolname
.br
.IB ordinal\ forward .IB ordinal\ forward
.RI [ flags ]\ exportname\ forwardname .RI [ flags ]\ exportname\ forwardname
.br .br
@ -351,6 +351,28 @@ following example defines the variable VariableA at ordinal 2 and
containing 4 ints: containing 4 ints:
.IP .IP
2 variable VariableA(-1 0xff 0 0) 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" .SS "Stub ordinals"
Syntax: Syntax:
.br .br
@ -371,19 +393,6 @@ This declaration defines an ordinal as an absolute value.
will be the name available for dynamic linking. will be the name available for dynamic linking.
.I data .I data
can be a decimal number or a hex number preceeded by "0x". 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" .SS "Forwarded ordinals"
Syntax: Syntax:
.br .br