Hi,

The simple question is: Is it or has it ever been possible to
compile shared libraries with tcc under linux/unix?

Here is a very simple test case:


$ cat mylib.c

int func(void)
{
        return 12345;
}


$ cat testlib.c

#include <stdio.h>

extern int func(void);

int main(void) {
        printf("%d\n", func());
        return 0;
}


Using gcc, I can simply compile these files and 
obtain a working shared library:

$ export LD_LIBRARY_PATH=`pwd`
$ gcc -fPIC -shared mylib.c -o libmylib.so
$ gcc testlib.c -L. -lmylib -o testlib
$ ./testlib 
12345

How can I do the same thing with tcc? I tried:

$ export LD_LIBRARY_PATH=`pwd`
$ tcc -r -shared mylib.c -o libmylib.so
$ tcc testlib.c -L. -lmylib -o testlib
$ ./testlib 
Segmentation fault


This is:

$ tcc -v
tcc version 0.9.24


Any suggestions or comments?

Olaf


_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to