win32: adjust new unicode support
- lib/Makefile: add (win)crt1_w.o - crt1.c/_runtmain: return to tcc & only use for UNICODE (because it might be not 100% reliable with for example wildcards (tcc *.c -run ...) - tccrun.c/tccpe.c: load -run startup_code only if called from tcc_run(). Otherwise main may not be defined. See libtcc_test.c - tests2/Makefile: pass extra options in FLAGS to allow overriding TCC Also: - tccpe.c: support weak attribute. (I first tried to solve the problem above by using it but then didn't)
This commit is contained in:
@ -68,22 +68,25 @@ int _twinstart(void)
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
int _runtwinmain(int argc0, /* as tcc passed in */ char **argv0)
|
||||
int _runtwinmain(int argc, /* as tcc passed in */ char **argv)
|
||||
{
|
||||
_TCHAR *szCmd, *p;
|
||||
|
||||
int argc;
|
||||
_TCHAR **argv;
|
||||
_TCHAR **env;
|
||||
_startupinfo start_info;
|
||||
#ifdef UNICODE
|
||||
int wargc;
|
||||
_TCHAR **wargv, **wenv;
|
||||
_startupinfo start_info = {0};
|
||||
|
||||
start_info.newmode = 0;
|
||||
__tgetmainargs(&argc, &argv, &env, 0, &start_info);
|
||||
__tgetmainargs(&wargc, &wargv, &wenv, 0, &start_info);
|
||||
if (argc < wargc)
|
||||
wargv += wargc - argc;
|
||||
#define argv wargv
|
||||
#endif
|
||||
|
||||
p = GetCommandLine();
|
||||
szCmd = NULL;
|
||||
if (argc0 > 1)
|
||||
szCmd = _tcsstr(p, argv[argc - argc0 + 1]);
|
||||
if (argc > 1)
|
||||
szCmd = _tcsstr(p, argv[1]);
|
||||
if (NULL == szCmd)
|
||||
szCmd = __T("");
|
||||
else if (szCmd > p && szCmd[-1] == __T('\"'))
|
||||
|
||||
Reference in New Issue
Block a user