On Sat, 2014-01-04 at 14:20 +0100, Christian Jullien wrote: > tcc and gcc are different. Gcc is an external tool that produces binary. > There is absolutely no problem for gcc to have GPL License. > The same applies for tcc for those who use tcc to produce binaries. > A very nice feature of tcc is that it can be used embedded in another program > to compile C code on the fly. > For example, my ISLISP version named OpenLisp (www.eligis.com) has a compiler > that compiles lisp file to C source code. > Currently, whether I use VC++, gcc, tcc, lcc, Watcom C... or any C compiler I > support, the process is to compile the generated source code and link the > binary into a new executable. > It would be nice to compile lisp code 'on the fly' with libtcc without having > to exit Lisp, compile, link and launch a new Lisp to use new compiled > function.
You don't need libtcc for that. You should generate C code into yourgenerated.c file, fork any compiler (e.g. gcc, clang, tcc, ....) to compile it into a dynamically loaded library (with GCC on Linux, that means gcc -Wall -fPIC -O -shared yourgenerated.c -o yourgenerated.so) then dynamically load the produced shared library (i.e. dlopen). I'm doing that routinely in MELT http://gcc-melt.org/ which is a Lispy domain specific language to extend GCC: I'm generating C++ code suitable for GCC internals, then compiling and dlopen-ing it, and all that in the same process (a cc1 or cc1plus started by some other gcc -fplugin=melt). AFAIK, all the major operating systems (Linux, AIX, Windows, Hurd, MacOSX ...) have dynamic loading facilities. Happy new 2014 year to everyone. Regards. -- Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mine, sont seulement les miennes} *** _______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
