Hi there,
I work on win platform.
As tcc can't use gcc's library (*.a) file, tcc can use *.def file (ONLY) for
dynamic link avoid making the library files.
For many libraries small or simple, I think tcc also should can use *.c file
(ONLY) as library.
For complicated case, library contains *.def and *.c files (BOTH), I think tcc
can try "*.def + *.c" instead of *.a as library.
So tcc can use all files as scripts. I used shell scripts for this purpose
before. :p
My changes on "libtcc.c" are bellow:
-----------------------------
/* the library name is the same as the argument of the '-l' option */
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", "%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 };
const char **pp = s->static_link ? libs + 1 : libs;
#endif
while (*pp) {
if (0 == tcc_add_library_internal(s, *pp,
libraryname, 0, s->library_paths, s->nb_library_paths)) {
#ifdef TCC_TARGET_PE
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;
}
-----------------------------
My tests succeed. Can it be submitted?
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel