aboutsummaryrefslogtreecommitdiff
path: root/libtcc.c
diff options
context:
space:
mode:
authorSteven G. Messervey <nuke48386@yahoo.com>2015-04-15 22:56:21 -0400
committerSteven G. Messervey <nuke48386@yahoo.com>2015-04-15 22:56:21 -0400
commitaeaff94ec1dba0096d7b943ad7c963d9d574d922 (patch)
tree590287410450e9dba0aab731b3db7792934abd8a /libtcc.c
parente50d68e4175d9ffa2915d67100ee8f9c5faf8cf1 (diff)
downloadtinycc-aeaff94ec1dba0096d7b943ad7c963d9d574d922.tar.gz
tinycc-aeaff94ec1dba0096d7b943ad7c963d9d574d922.tar.bz2
implement #pragma comment(lib,...)
Diffstat (limited to 'libtcc.c')
-rw-r--r--libtcc.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libtcc.c b/libtcc.c
index 6f88989..de19a64 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -829,13 +829,31 @@ static int tcc_compile(TCCState *s1)
LIBTCCAPI int tcc_compile_string(TCCState *s, const char *str)
{
+ int i;
int len, ret;
len = strlen(str);
tcc_open_bf(s, "<string>", len);
memcpy(file->buffer, str, len);
+
+ len = s->nb_files;
ret = tcc_compile(s);
tcc_close();
+
+ /* habdle #pragma comment(lib,) */
+ for(i = len; i < s->nb_files; i++) {
+ /* int filetype = *(unsigned char *)s->files[i]; */
+ const char *filename = s->files[i] + 1;
+ if (filename[0] == '-' && filename[1] == 'l') {
+ if (tcc_add_library(s, filename + 2) < 0) {
+ tcc_warning("cannot find '%s'", filename+2);
+ ret++;
+ }
+ }
+ tcc_free(s->files[i]);
+ }
+ s->nb_files = len;
+
return ret;
}