Revert "ability to compile multiple *.c files with -c switch"
copy & paste coding, twisted control flow
This reverts commit a13f183e4c.
Also, set linker args for DLLs also.
This commit is contained in:
21
libtcc.c
21
libtcc.c
@ -1061,7 +1061,7 @@ LIBTCCAPI TCCState *tcc_new(void)
|
||||
#else
|
||||
tcc_set_lib_path(s, CONFIG_TCCDIR);
|
||||
#endif
|
||||
s->output_type = 0;
|
||||
|
||||
preprocess_new();
|
||||
s->include_stack_ptr = s->include_stack;
|
||||
|
||||
@ -1229,10 +1229,6 @@ LIBTCCAPI void tcc_delete(TCCState *s1)
|
||||
|
||||
tcc_cleanup();
|
||||
|
||||
/* close a preprocessor output */
|
||||
if (s1->ppfp && s1->ppfp != stdout)
|
||||
fclose(s1->ppfp);
|
||||
|
||||
/* free all sections */
|
||||
for(i = 1; i < s1->nb_sections; i++)
|
||||
free_section(s1->sections[i]);
|
||||
@ -1609,16 +1605,6 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type)
|
||||
{
|
||||
s->output_type = output_type;
|
||||
|
||||
if (s->output_type == TCC_OUTPUT_PREPROCESS) {
|
||||
if (!s->outfile) {
|
||||
s->ppfp = stdout;
|
||||
} else {
|
||||
s->ppfp = fopen(s->outfile, "w");
|
||||
if (!s->ppfp)
|
||||
tcc_error("could not write '%s'", s->outfile);
|
||||
}
|
||||
}
|
||||
|
||||
if (!s->nostdinc) {
|
||||
/* default include paths */
|
||||
/* -isystem paths have already been handled */
|
||||
@ -2289,6 +2275,9 @@ ST_FUNC int tcc_parse_args1(TCCState *s, int argc, char **argv)
|
||||
s->print_search_dirs = 1;
|
||||
break;
|
||||
case TCC_OPTION_run:
|
||||
#ifndef TCC_IS_NATIVE
|
||||
tcc_error("-run is not available in a cross compiler");
|
||||
#endif
|
||||
if (s->output_type)
|
||||
tcc_warning("-run: some compiler action already specified (%d)", s->output_type);
|
||||
s->output_type = TCC_OUTPUT_MEMORY;
|
||||
@ -2397,7 +2386,7 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv)
|
||||
s->nb_libraries++;
|
||||
}
|
||||
|
||||
if (s->output_type == TCC_OUTPUT_EXE)
|
||||
if (s->output_type == TCC_OUTPUT_EXE || s->output_type == TCC_OUTPUT_DLL)
|
||||
tcc_set_linker(s, (const char *)pas->linker_arg.data);
|
||||
|
||||
if (is_allocated) {
|
||||
|
||||
Reference in New Issue
Block a user