win32: handle __declspec(dllimport)

This commit is contained in:
grischka
2009-11-13 17:14:05 +01:00
parent dd70d19267
commit 5b113f3ee3
4 changed files with 50 additions and 4 deletions

View File

@ -1100,8 +1100,9 @@ void gen_opic(int op)
}
goto general_case;
} else if (c2 && (op == '+' || op == '-') &&
((vtop[-1].r & (VT_VALMASK | VT_LVAL | VT_SYM)) ==
(VT_CONST | VT_SYM) ||
(((vtop[-1].r & (VT_VALMASK | VT_LVAL | VT_SYM)) == (VT_CONST | VT_SYM)
&& !(vtop[-1].sym->type.t & VT_IMPORT))
||
(vtop[-1].r & (VT_VALMASK | VT_LVAL)) == VT_LOCAL)) {
/* symbol + constant case */
if (op == '-')
@ -2257,6 +2258,9 @@ static void parse_attribute(AttributeDef *ad)
case TOK_DLLEXPORT:
FUNC_EXPORT(ad->func_attr) = 1;
break;
case TOK_DLLIMPORT:
FUNC_IMPORT(ad->func_attr) = 1;
break;
default:
if (tcc_state->warn_unsupported)
warning("'%s' attribute ignored", get_tok_str(t, NULL));
@ -5131,6 +5135,10 @@ static void decl(int l)
/* NOTE: as GCC, uninitialized global static
arrays of null size are considered as
extern */
#ifdef TCC_TARGET_PE
if (FUNC_IMPORT(ad.func_attr))
type.t |= VT_IMPORT;
#endif
external_sym(v, &type, r);
} else {
type.t |= (btype.t & VT_STATIC); /* Retain "static". */