tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] #pragma comment(lib,...) patch


From: Steven G. Messervey
Subject: Re: [Tinycc-devel] #pragma comment(lib,...) patch
Date: Tue, 14 Apr 2015 12:48:55 -0400

Sorry to keep flip-flopping!

My original test case for libtcc used tcc_add_file(...) to execute the 
compilation.
My target application uses tcc_compile_string(...).
When using compile_string, the #pragma has no effect, an tcc complains about 
unknown symbols.

If it's of any help, tcc -run won't link static libs, either:

/* hello.c */
#include <stdio.h>
void hello(void) {
  printf("Hello\n");
}
/* end hello .c */

$> gcc -c hello.c
$> ar rcs libhello.a hello.o

/* dumb.c */
extern void hello(void);
int main(int argc, char **argv) {
  hello();
  return 0;
/* end dumb.c */

tcc -vv -L. -lhello -run dumb.c
tcc version 0.9.26 (i386, Linux)
-> ./libhello.a
-> dumb.c
-> /usr/include/stdio.h
->  /usr/include/features.h
->   /usr/include/i386-linux-gnu/bits/predefs.h
->   /usr/include/i386-linux-gnu/sys/cdefs.h
->    /usr/include/i386-linux-gnu/bits/wordsize.h
->   /usr/include/i386-linux-gnu/gnu/stubs.h
->    /usr/include/i386-linux-gnu/bits/wordsize.h
->    /usr/include/i386-linux-gnu/gnu/stubs-32.h
->  /usr/local/lib/tcc/include/stddef.h
->  /usr/include/i386-linux-gnu/bits/types.h
->   /usr/include/i386-linux-gnu/bits/wordsize.h
->   /usr/include/i386-linux-gnu/bits/typesizes.h
->  /usr/include/libio.h
->   /usr/include/_G_config.h
->    /usr/local/lib/tcc/include/stddef.h
->    /usr/include/wchar.h
->   /usr/local/lib/tcc/include/stdarg.h
->  /usr/include/i386-linux-gnu/bits/stdio_lim.h
->  /usr/include/i386-linux-gnu/bits/sys_errlist.h
-> /usr/lib/i386-linux-gnu/libc.so
-> /lib/i386-linux-gnu/libc.so.6
-> /usr/lib/i386-linux-gnu/libc_nonshared.a
-> /usr/local/lib/tcc/i386/libtcc1.a
tcc: error: undefined symbol 'hello' 

As you can see at the top of the output, './libhello.a' is found, and 
recognized as a static library, but tcc cannot link it in.

Have we uncovered a can of worms?

Thanks,
  Steven G.




reply via email to

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