tccpe: with -l try also with "lib" prefix

-lfoo searches: foo.def, libfoo.def, foo.dll, libfoo.dll
master
grischka 2009-12-19 22:09:27 +01:00
parent 94bf4d2c22
commit 3020a4765d
1 changed files with 11 additions and 8 deletions

19
tccpe.c
View File

@ -1611,15 +1611,18 @@ PUB_FN int pe_load_file(struct TCCState *s1, const char *filename, int fd)
return ret;
}
int pe_add_dll(struct TCCState *s, const char *libraryname)
int pe_add_dll(struct TCCState *s, const char *libname)
{
char buf[MAX_PATH];
snprintf(buf, sizeof(buf), "%s.def", libraryname);
if (tcc_add_dll(s, buf, 0) == 0)
return 0;
snprintf(buf, sizeof(buf), "%s.dll", libraryname);
if (tcc_add_dll(s, buf, 0) == 0)
return 0;
static const char *pat[] = {
"%s.def", "lib%s.def", "%s.dll", "lib%s.dll", NULL
};
const char **p = pat;
do {
char buf[MAX_PATH];
snprintf(buf, sizeof(buf), *p, libname);
if (tcc_add_dll(s, buf, 0) == 0)
return 0;
} while (*++p);
return -1;
}