tccgen/win32: let __declspec(dllimport) imply extern
Also, retain storage qualifiers in type_decl, in particular
also for function pointers. This allows to get rid of this
very early hack in decl()
type.t |= (btype.t & VT_STATIC); /* Retain "static". */
which was to fix the case of
int main() { static int (*foo)(); ...
Also:
- missing __declspec(dllimport) is an error now
- except if the symbol is "_imp__symbol"
- demonstrate export/import of data in the dll example (while
'extern' isn't strictly required with dllimport anymore)
- new function 'patch_storage()' replaces 'weaken_symbol()'
and 'apply_visibility()'
- new function 'update_storage()' applies storage attributes
to Elf symbols.
- put_extern_sym/2 accepts new pseudo section SECTION_COMMON
- add -Wl,-export-all-symbols as alias for -rdynamic
- add -Wl,-subsystem=windows for mingw compatibility
- redefinition of 'sym' error for initialized global data
This commit is contained in:
6
libtcc.c
6
libtcc.c
@ -1299,6 +1299,8 @@ static int link_option(const char *str, const char *val, const char **ptr)
|
||||
if (*p != ',' && *p != '=')
|
||||
return 0;
|
||||
p++;
|
||||
} else if (*p) {
|
||||
return 0;
|
||||
}
|
||||
*ptr = p;
|
||||
return ret;
|
||||
@ -1369,6 +1371,8 @@ static int tcc_set_linker(TCCState *s, const char *option)
|
||||
ignoring = 1;
|
||||
} else if (link_option(option, "O", &p)) {
|
||||
ignoring = 1;
|
||||
} else if (link_option(option, "export-all-symbols", &p)) {
|
||||
s->rdynamic = 1;
|
||||
} else if (link_option(option, "rpath=", &p)) {
|
||||
copy_linker_arg(&s->rpath, p, ':');
|
||||
} else if (link_option(option, "enable-new-dtags", &p)) {
|
||||
@ -1390,7 +1394,7 @@ static int tcc_set_linker(TCCState *s, const char *option)
|
||||
s->pe_subsystem = 1;
|
||||
} else if (!strcmp(p, "console")) {
|
||||
s->pe_subsystem = 3;
|
||||
} else if (!strcmp(p, "gui")) {
|
||||
} else if (!strcmp(p, "gui") || !strcmp(p, "windows")) {
|
||||
s->pe_subsystem = 2;
|
||||
} else if (!strcmp(p, "posix")) {
|
||||
s->pe_subsystem = 7;
|
||||
|
||||
Reference in New Issue
Block a user