diff options
| author | YX Hao <lifenjoiner@163.com> | 2014-06-16 16:00:46 +0800 |
|---|---|---|
| committer | YX Hao <lifenjoiner@163.com> | 2014-06-16 16:00:46 +0800 |
| commit | 7a3f6d49415fd5f1fa99d25aba40c7884d5774a4 (patch) | |
| tree | 640612c2f681252b29e15e31abbf667135c75fdc | |
| parent | d316836008f4738d5a020b28aa33e96a82a81aca (diff) | |
| download | tinycc-7a3f6d49415fd5f1fa99d25aba40c7884d5774a4.tar.gz tinycc-7a3f6d49415fd5f1fa99d25aba40c7884d5774a4.tar.bz2 | |
Win: Enable use "*.def + *.c" files as library instead of *.a by "-l" option
example: "-lshell32" will try "shell32.def + shell32.c"
Add lib type "%s/%s.c" for tcc_add_library() ('-l' option parse)
So tcc can use all files as scripts.
| -rw-r--r-- | libtcc.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -1300,7 +1300,7 @@ ST_FUNC int tcc_add_crt(TCCState *s, const char *filename) LIBTCCAPI int tcc_add_library(TCCState *s, const char *libraryname) { #ifdef TCC_TARGET_PE - const char *libs[] = { "%s/%s.def", "%s/lib%s.def", "%s/%s.dll", "%s/lib%s.dll", "%s/lib%s.a", NULL }; + const char *libs[] = { "%s/%s.def", "%s/lib%s.def", "%s/%s.dll", "%s/lib%s.dll", "%s/lib%s.a", "%s/%s.c", NULL }; const char **pp = s->static_link ? libs + 4 : libs; #else const char *libs[] = { "%s/lib%s.so", "%s/lib%s.a", NULL }; @@ -1308,8 +1308,15 @@ LIBTCCAPI int tcc_add_library(TCCState *s, const char *libraryname) #endif while (*pp) { if (0 == tcc_add_library_internal(s, *pp, - libraryname, 0, s->library_paths, s->nb_library_paths)) + libraryname, 0, s->library_paths, s->nb_library_paths)) { +#ifdef TCC_TARGET_PE + /* extra search for *.c file together with *.def file */ + if (pp < libs + 2) + tcc_add_library_internal(s, *(libs + 5), libraryname, 0, + s->library_paths, s->nb_library_paths); +#endif return 0; + } ++pp; } return -1; |
