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.
Unified · Split
| @@ -1300,7 +1300,7 @@ ST_FUNC int tcc_add_crt(TCCState *s, const char *filename) · 1299 unmodified lines | ||
| 1300 | 1300 | LIBTCCAPI int tcc_add_library(TCCState *s, const char *libraryname) |
| 1301 | 1301 | { |
| 1302 | 1302 | #ifdef TCC_TARGET_PE |
| 1303 | − const char *libs[] = { "%s/%s.def", "%s/lib%s.def", "%s/%s.dll", "%s/lib%s.dll", "%s/lib%s.a", NULL }; | |
| 1303 | + 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 }; | |
| 1304 | 1304 | const char **pp = s->static_link ? libs + 4 : libs; |
| 1305 | 1305 | #else |
| 1306 | 1306 | 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) · 1 unmodified line | ||
| 1308 | 1308 | #endif |
| 1309 | 1309 | while (*pp) { |
| 1310 | 1310 | if (0 == tcc_add_library_internal(s, *pp, |
| 1311 | − libraryname, 0, s->library_paths, s->nb_library_paths)) | |
| 1311 | + libraryname, 0, s->library_paths, s->nb_library_paths)) { | |
| 1312 | +#ifdef TCC_TARGET_PE | |
| 1313 | + /* extra search for *.c file together with *.def file */ | |
| 1314 | + if (pp < libs + 2) | |
| 1315 | + tcc_add_library_internal(s, *(libs + 5), libraryname, 0, | |
| 1316 | + s->library_paths, s->nb_library_paths); | |
| 1317 | +#endif | |
| 1312 | 1318 | return 0; |
| 1319 | + } | |
| 1313 | 1320 | ++pp; |
| 1314 | 1321 | } |
| 1315 | 1322 | return -1; |