diff options
| author | grischka <grischka> | 2017-02-18 09:51:23 +0100 |
|---|---|---|
| committer | grischka <grischka> | 2017-02-18 09:51:23 +0100 |
| commit | 096125d963400951e0f160ced86416ef8c9c98b0 (patch) | |
| tree | c0fb4737ba1cf421032e28925f9aef6c140d97aa /win32/lib/crt1.c | |
| parent | 39b2afeb7c5c7de9a6c6457b5a4ec102d4e364b1 (diff) | |
| download | tinycc-096125d963400951e0f160ced86416ef8c9c98b0.tar.gz tinycc-096125d963400951e0f160ced86416ef8c9c98b0.tar.bz2 | |
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)
Diffstat (limited to 'win32/lib/crt1.c')
| -rw-r--r-- | win32/lib/crt1.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/win32/lib/crt1.c b/win32/lib/crt1.c index 1e2bd17..a9b1a30 100644 --- a/win32/lib/crt1.c +++ b/win32/lib/crt1.c @@ -65,24 +65,23 @@ void _tstart(void) exit(ret); } -void _runtmain(int argc0, /* as tcc passed in */ char **argv0) +int _runtmain(int argc, /* as tcc passed in */ char **argv) { - __TRY__ - int argc, ret; - _TCHAR **argv; - _TCHAR **env; - _startupinfo start_info; +#ifdef UNICODE + int wargc; + _TCHAR **wargv, **wenv; + _startupinfo start_info = {0}; - __set_app_type(_CONSOLE_APP); + __tgetmainargs(&wargc, &wargv, &wenv, _dowildcard, &start_info); + if (argc < wargc) + wargv += wargc - argc; +#define argv wargv +#endif #ifdef __i386 _controlfp(_PC_53, _MCW_PC); #endif - - start_info.newmode = 0; - __tgetmainargs( &argc, &argv, &env, _dowildcard, &start_info); - ret = _tmain(argc0, argv + argc - argc0, env); - exit(ret); + return _tmain(argc, argv, NULL); } // ============================================= |
