tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Sugggestion: Add lib type *.c for tcc_add_library() o


From: grischka
Subject: Re: [Tinycc-devel] Sugggestion: Add lib type *.c for tcc_add_library() on windows ('-l' option parse)
Date: Wed, 18 Jun 2014 19:51:50 +0200
User-agent: Thunderbird 2.0.0.23 (Windows/20090812)

address@hidden wrote:

"w32api" is really useful, but NOT convenient for TCC to build the libs.

Try to write the documentation for the behavior of the patch below
and then we can ask people what is more convenient:
- to read and understand that documentation or
- to type one more filename on the tcc command-line

-- gr

---------------- whole tcc_add_library() ----------------------
/* 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;
/*+*/    const char *filename;
#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
/*+*/            /* extra search for c file together with def file if there is 
no dll */
/*+*/            if (pp < libs + 2) {
/*+*/                filename = tcc_strdup(s->target_deps[s->nb_target_deps - 
1]);
/*+*/                strcpy(tcc_fileextension(filename), ".dll");
/*+*/                if (tcc_open(s, filename) < 0) {
/*+*/                    strcpy(tcc_fileextension(filename), ".c");
/*+*/                    tcc_add_file_internal(s, filename, 0);
/*+*/                } else
/*+*/                    tcc_close();
/*+*/            }
/*+*/#endif
            return 0;
/*+*/        }
        ++pp;
    }
    return -1;
}
---------------- replace all "/*+*/" to "" ------------------





reply via email to

[Prev in Thread] Current Thread [Next in Thread]