tinycc-devel
[Top][All Lists]
Advanced

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

[Tinycc-devel] linux/unix shared libraries?


From: Olaf Dietrich
Subject: [Tinycc-devel] linux/unix shared libraries?
Date: Mon, 21 Apr 2008 10:11:23 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

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




reply via email to

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