History

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.

YX Hao committed 12 years ago

Commit 7a3f6d41 parent d3168361 file · +9 −2Browse files

Unified · Split

libtcc.c+9−2
@@ -1300,7 +1300,7 @@ ST_FUNC int tcc_add_crt(TCCState *s, const char *filename) · 1299 unmodified lines
13001300 LIBTCCAPI int tcc_add_library(TCCState *s, const char *libraryname)
13011301 {
13021302 #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 };
13041304 const char **pp = s->static_link ? libs + 4 : libs;
13051305 #else
13061306 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
13081308 #endif
13091309 while (*pp) {
13101310 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
13121318 return 0;
1319+ }
13131320 ++pp;
13141321 }
13151322 return -1;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t