aboutsummaryrefslogtreecommitdiff
path: root/tcc.c
diff options
context:
space:
mode:
authorgrischka <grischka>2009-04-18 13:17:27 +0200
committergrischka <grischka>2009-04-18 15:08:03 +0200
commitd165e87340c3e802f2d0c6354934c5529386fa84 (patch)
tree07eb2800638ca4daf1e2053c6f83cc4fd5731d99 /tcc.c
parent73ba078d2f703ab991ddc36b3504d96f35466700 (diff)
downloadtinycc-d165e87340c3e802f2d0c6354934c5529386fa84.tar.gz
tinycc-d165e87340c3e802f2d0c6354934c5529386fa84.tar.bz2
libtcc: new api tcc_set_lib_path
Diffstat (limited to 'tcc.c')
-rw-r--r--tcc.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/tcc.c b/tcc.c
index fba0fd6..ae382c2 100644
--- a/tcc.c
+++ b/tcc.c
@@ -1122,7 +1122,7 @@ char *normalize_slashes(char *path)
return path;
}
-char *w32_tcc_lib_path(void)
+void tcc_set_lib_path_w32(TCCState *s)
{
/* on win32, we suppose the lib and includes are at the location
of 'tcc.exe' */
@@ -1134,7 +1134,7 @@ char *w32_tcc_lib_path(void)
else if (p > path)
p--;
*p = 0;
- return strdup(path);
+ tcc_set_lib_path(s, path);
}
#endif
@@ -10967,6 +10967,12 @@ int tcc_set_flag(TCCState *s, const char *flag_name, int value)
flag_name, value);
}
+/* set CONFIG_TCCDIR at runtime */
+void tcc_set_lib_path(TCCState *s, const char *path)
+{
+ tcc_lib_path = tcc_strdup(path);
+}
+
#if !defined(LIBTCC)
static int64_t getclock_us(void)
@@ -11217,7 +11223,7 @@ int parse_args(TCCState *s, int argc, char **argv)
break;
case TCC_OPTION_B:
/* set tcc utilities path (mainly for tcc development) */
- tcc_lib_path = optarg;
+ tcc_set_lib_path(s, optarg);
break;
case TCC_OPTION_l:
dynarray_add((void ***)&files, &nb_files, r);
@@ -11350,11 +11356,10 @@ int main(int argc, char **argv)
char objfilename[1024];
int64_t start_time = 0;
+ s = tcc_new();
#ifdef _WIN32
- tcc_lib_path = w32_tcc_lib_path();
+ tcc_set_lib_path_w32(s);
#endif
-
- s = tcc_new();
output_type = TCC_OUTPUT_EXE;
outfile = NULL;
multiple_files = 1;